How to move files in Knime with “Transfer Files” node to another directory without copying the files’ subdirectories? That is, keep only the files without their respective directories?
Hi @Perciliano ,
From the transfer files node, you can set if you will pass only the file, the path and all content. And, If you want to delete the source files, you can do it too.
Hi denisfi, thanks. But as shown:
1 - has a folder structure with subfolders and files inside them
2 - files inside the subfolders
3 - With the configuration suggested by you it is not possible, because this only does with a file
4 - With this configuration it copies the files, but with the subfolders. I don’t want the subfolders, just the files
5 - Result of executing step 5.
I think there’s a way to solve it with a Python script, I don’t know it and I haven’t tried it either. I made a script in “.bat”, but I run it outside of KNIME, I don’t know if there is any node to put this script there, it would help me.
Thanks in advance for the help.
Could you bring a demo workflow to see it? You pass the file/folder as direct path or by flow variables? How do you say the original and the goto folder?
Your print don’t say much, but if you have some steps before that you use it, I’d like to see or know about for better understand about it.
the Node does not implement a “flattening” option like you would like to have it. One problem is that you will likely end up with conflicts when having the same name for a file for instance. What you could to is to list only the files with the List Files/Folders node and use the output as the input for the table based Transfer Files Node. I hope this helps and that I understood your problem correctly
@Perciliano you can list the files you want and extract the file names and extensions and then name a single target folder and construct new paths for all files and then transfer them.
You would have to decide what should happen if there are duplicates or files with the same name:
in case you are wondering. You can also move whole folder structures to new places and keep the sub-folder structure like in this example with workflows:
Great solutions, got it. Grateful.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.