Create a folder from the path of a file and move the file inside


This is my first post so please go easy on me :smiley:.

In a dual-display Lister, I would like to create a new folder in the second list from the selection of a file from the first list (with flattened display).

I try to create an advanced button but I'm not strong enough to make it alone, it seems to me. :sleepy:

In the first list I select a file :

In the second list, I would like the folder to be created and the file moved inside :

Could you help me do that?


Try this

Copy MOVE CREATEFOLDER="{destpath}{sourcepath|nopath}"

Which folder are you in when you select the file?

Do you just want the file to be copied to a new folder named after its parent folder, or do you want to create the whole hierarchy of folders from the flat-view starting point down to where the file is?

Hello Ixp and Leo,

Thank you for your interest in my request.

I am in the folder "FOLDER-A" and the display is in "Flat View: Mixed (No Folders)".
I would like the file to be moved (not copied) to a new folder named after its parent folder.
I add 2 images to better understand.

Try this:

Copy MOVE CREATEFOLDER={filepath$|..|nopath|noterm} FLATVIEWCOPY=single

If needed: How to use buttons and scripts from this forum

A big thank you to you Leo ! :+1:

Your solution works 99.9%!
In fact the "FLATVIEWCOPY = single" was too much because it is the parent folder of the file that interests me and not the very first folder.

As usual Directory Opus will save me a very precious time! Thanks to you ! :star_struck::star_struck::star_struck:

FLATVIEWCOPY=single stops the command asking you how you want to copy, and potentially creating additional folders that you don't want.

Yes you're right, it was me who took my feet in the carpet with the copy / paste of files that I was doing manually to test your solution ...

In fact your solution works 100% !

A big thank-you. :+1::star_struck::+1:

1 Like