Is there a way to remove all the subfolders of files?

Hi,
I use a node to read a folder with sub-folders. Now I can see my 2k images not very well placed thanks to photos.app…

I would like to move all the files to a simple / single folder. So they are all in one space.

I tried to add a node write, specify a folder but it keeps the sub-folder structure.
How can I ignore the structure ?

Thank you

I am still interesting to find the solution with retrobatch, but I used a bash code to do it before the answer :slight_smile:

cd your/folder/
find . -mindepth 2 -type f -exec echo mv {} . \;     (dry run)
find . -mindepth 2 -type f -exec mv {} . \;      (run)

I have an unofficial way to do this, using a private Retrobatch JS API.

You can add a JavaScript node after the read folder node and set the contents of the node to the following:

function processAsset(document, jsnode, asset) {
    asset.setOutputSubFolder(null);
    return true;
}

I’ll also attach a sample workflow:
RemoveSubfolderInfo.retrobatch (2.2 KB)

That should do the trick for now, though it might break in the future (it’s considered a private API, but I’ll try and add something equivalent to the API set at some point).

Thank you so much for your quick answer :slight_smile:

It makes me think of n8n and the node Code. Great idea !

For the write node, it might be good to have a checkbox that says : “Ignore subfolder structure” for example.

Best,
Joffrey