Create New Directory and Move Files Script

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
iryx
Posts: 26
Joined: 29 Jan 2007 16:51

Create New Directory and Move Files Script

Post by iryx »

I have a directory with a big amount of files. I would like to use the scripting feature to: 1. create a new directory and 2. move the selected files in the new directory.

I'm sure there is an easy way but I can't seem to get it yet. Any thoughts?

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Re: Create New Directory and Move Files Script

Post by jacky »

iryx wrote:I have a directory with a big amount of files. I would like to use the scripting feature to: 1. create a new directory and 2. move the selected files in the new directory.

I'm sure there is an easy way but I can't seem to get it yet. Any thoughts?
Not sure what exactly you want to do, but to move selected items anywhere you can simply use command moveto
And if the destination folder doesn't exists, XY will create it on-the-fly ! That's a standard feature of XY's Move/Copy/Backup To feature, i.e. works the same using the GUI
Proud XYplorer Fanatic

iryx
Posts: 26
Joined: 29 Jan 2007 16:51

Sorry, I wasn't clear

Post by iryx »

I want a new folder to be created every time I invoke the command. That could be either based on the first file in the selection or based on the date and time.

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Re: Sorry, I wasn't clear

Post by jacky »

iryx wrote:I want a new folder to be created every time I invoke the command. That could be either based on the first file in the selection or based on the date and time.
moveto "<curbase>";
or
moveto "<dyyyy-mm-dd hh-nn>";

Syntax here
Proud XYplorer Fanatic

admin
Site Admin
Posts: 65185
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Sorry, I wasn't clear

Post by admin »

iryx wrote:I want a new folder to be created every time I invoke the command. That could be either based on the first file in the selection or based on the date and time.
This should do (selects all items in current folder, then moves them to newly created (if nececssary) subfolder named acc. to current date/time:

sel a; moveto "<dyyyy-mm-dd hh-nn>";

Try with care on some test files...

iryx
Posts: 26
Joined: 29 Jan 2007 16:51

Current Solution

Post by iryx »

Close,

here is what I ended up doing:
input $ext, Enter Name, _<dyyyy.mm.dd>-<curbase>;moveto $ext

since I only wanted to move the selected items to a new subdirectory based on the name of the selected items and not all files.

Post Reply