Page 1 of 1

Does anyone have a script that does this...

Posted: 06 Oct 2021 14:52
by Vocalpoint
If I do this:

Highlight one (or many files) in any random directory

Is there a script out there for XY to do this:

Create a new folder (in the directory where the files are) named with today's date in this format (MM-DD-YYYY)
Move all highlighted files to this newly created directory

Appreciate any assistance.

Cheers!

VP

Re: Does anyone have a script that does this...

Posted: 06 Oct 2021 15:22
by highend
new()
moveto()

Re: Does anyone have a script that does this...

Posted: 06 Oct 2021 16:40
by Vocalpoint
highend wrote: 06 Oct 2021 15:22 new()
moveto()
Highend

I get the basics of what are getting at but how does this take "selected" files into context? If I have 40 files in the directory and only highlight 4 of them - I only want those four to go into a folder with today's date.

I found this snippet in the forum:

$SelectedItems = get("SelectedItemsPathNames", "|");
moveto "<date mm-dd-yyyy>", $SelectedItems;

But when test it (via Test Script) - it does nothing?

Cheers

VP

Re: Does anyone have a script that does this...

Posted: 06 Oct 2021 16:43
by highend
moveto() help entry?
source [optional] The item(s) that will be copied or moved. Alternatively it can point to the source control (":tree", ":list", or ":catalog"), or to a text file containing a list of source items ("*filename"; see below).
If missing then the selected items of the focused control (List, Tree, Catalog) are used.

Re: Does anyone have a script that does this...

Posted: 06 Oct 2021 18:32
by yusef88
just as a tip you can select files, press (Ctrl+Shift+X) and choose date from drop down menu

Re: Does anyone have a script that does this...

Posted: 06 Oct 2021 19:10
by Vocalpoint
yusef88 wrote: 06 Oct 2021 18:32 just as a tip you can select files, press (Ctrl+Shift+X) and choose date from drop down menu
Except I would need to have every relative date (potentially 365) at the ready on the drop down. I do not want to have to type anything and need it to work on the fly.

BTW: I finally have some working code (and it's quite simple):

foreach($item, "<get SelectedItemsPathNames |>") {
moveto "<date mm-dd-yyyy>", $item, , 2;
}

Cheers!

VP

Re: Does anyone have a script that does this...

Posted: 06 Oct 2021 19:13
by highend
Apart from that it doesn't make much sense to create a date on each loop, a simple
moveto "<date mm-dd-yyyy>", , , 2;
does the exact same thing

Can you please put code into BBCode tags?

Re: Does anyone have a script that does this...

Posted: 06 Oct 2021 19:21
by Vocalpoint
highend wrote: 06 Oct 2021 19:13 Apart from that it doesn't make much sense to create a date on each loop, a simple
moveto "<date mm-dd-yyyy>", , , 2;
does the exact same thing

Can you please put code into BBCode tags?
Even better!

And how exactly do I put the code in BBCode tags within this editor? Is it the Code Display button?

Thanks!

VP

Re: Does anyone have a script that does this...

Posted: 06 Oct 2021 19:26
by highend
1.png
1.png (15.64 KiB) Viewed 2630 times

Re: Does anyone have a script that does this...

Posted: 06 Oct 2021 19:28
by Vocalpoint
highend wrote: 06 Oct 2021 19:261.png
Thanks!

Will remember for next time.

Thanks for the help today.

Cheers!

VP