Button to add folder to filename on copy

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
jdev21
Posts: 45
Joined: 08 Oct 2014 22:13

Button to add folder to filename on copy

Post by jdev21 »

Would this be possible to do using scripts in XY?
Select a file > Click a button > file is moved to D:\Shared with the old folder name as a new prefix

so C:\coolfiles\a.mp3 would become D:\Shared\coolfiles - a.mp3

jupe
Posts: 2794
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: Button to add folder to filename on copy

Post by jupe »

The topic says copy, the post says move, but if you really mean move and if you make sure this this option is enabled:

Configuration | General | Sort and Rename | Rename | Allow move on rename

Then this should work:

Code: Select all

rename "l", "D:\Shared\<curfolder> - <curname>", "p";
It will pop a preview window for you to check if it looks ok, if everything looks ok then you can remove the "p" part if you never want to see a preview.

jdev21
Posts: 45
Joined: 08 Oct 2014 22:13

Re: Button to add folder to filename on copy

Post by jdev21 »

I did mean copy rather than move, sorry. Would this be possible without modifying the original file?

jupe
Posts: 2794
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: Button to add folder to filename on copy

Post by jupe »

This should work, for single files:

Code: Select all

copyitem , "D:\Shared\<curfolder> - <curname>";
Or if you want it to work for multi-selection too:

Code: Select all

copyas "<curfolder> - *.?", "D:\Shared";
The help file is the best place to look for help on the scripting commands.

Post Reply