Copy & Rename a file diffrent directory

Hello,
I actually have a relatively simple problem.
I would like to copy a file name.table and copy it with a different name name_check.table to another directory.

I got it with the List files folder node create directory. Attempted copy / move Files (legacy) node, string manipulation node variable, but simply no file copy is created in the directory.

I search the forum but i didn´t found an example or I missed it.

Thx in advance.

greetings

You could try and use the (legacy) Copy/Move file node and create individual names as URIs (eg give a prefix or change the name):

Also there are thes examples using the new path variables that try to manipulate and transfer files.

Hello @mlauber71 ,

Many thanks for the quick reply.

Below I show the two setups of my workflow:
2021-07-02 11_06_59-KNIME Analytics Platform

The Table Writer Node creates the file with the name BelegNr-Kontroll.table:
Ordner 1

I now want to rename this file to Beleg Nr-Kontrolle Check.table and copy/move it to the folder “BelegNrtablefuerkontrolle
Ordner 2 mit neuer Datei

With the transfer Files node it is easy to copy the file “Beleg Nr-Kontrolle Check.table” in subfolder “BelegNrtablefuerkontrolle”, but i find no way to change the file-name.

I hope i can do this with the "string manipulation (variable) Node, but i don´t work:
String manipulation

Connect this Node to the table Writer Variable output port an connect it with die copy/move node:
2021-07-02 11_18_14-KNIME Analytics Platform
No result!

I’m still doing something wrong or do not understand the node copy / move files correctly what they do and which parameters are required for renaming the file name.

greetings

If you have knime 4.4 installed you can use the transfer files (table) node and in order to manipulate the file names the column expressions node. It now supports path columns.

3 Likes

You might want to check this example:

2 Likes

Do exactly what I want! Perfect!

But it is very difficult to understand for beginners in KNIME!

Thx !!

Greetings

@USCHUKN1ME it might be there is a simpler way but there are various methods to handle files and paths and nodes to manipulate them. In general I recommend reading the:

https://docs.knime.com/latest/analytics_platform_file_handling_guide/index.html

a long read but very useful to understand how KNIME is working with its data

1 Like

Hello @Mark_Ortmann ,

I get to copy the file with this node, but renaming is not (yet) accessible to me with this node!

Transfer file node

Select from Table rather than from file chooser. This allows you to select the column in the table containing the new file names. You also might wonna check delete so your old files are being deleted. The node internally currently copies the file rather than doing a rename operation.

Btw. The column to select has to be a path not an uri column

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.