I wrote them a while back when I needed it, and kinda forgot about them. I just thought of it again as something like that was asked by kartal, so there you go.
Please note that :
1. you need to switch Recursion Checker off, because there's a loop involved
2. it will move all files in the current folder, if you want something to work only on some/selected files, you'll have to adjust the script obviously (could be done with the help of Looping Through Selected Items I guess, though that one might not be fully compatible with the latest syntax changes!)
Why two scripts? Okay, first one is a very basic thing, just do the work :
Code: Select all
"Move all files into subfolders based on their Modified date"
// Required config
setting "HideFoldersInList", 1;
// focus list (matters for moveto)
focus l;
// go up on List
sel 1,1;
// start the loop if there's a file to move...
regexreplace $next, <curitem>, "^$", "_done";
regexreplace $next, $next, "^((?!_done).)*$", "_loop";
sub $next;
"_loop"
// move current item
moveto "<curpath>\<datem yyyy-mm>\";
// go up on List
sel 1,1;
// continue loop if there's a file to move...
regexreplace $next, <curitem>, "^$", "_done";
regexreplace $next, $next, "^((?!_done).)*$", "_loop";
sub $next;
"_done"
// done
status "Finished!"
Code: Select all
"Move all files into subfolders based on their Modified date - v2"
// focus list (matters for moveto)
focus l;
// Select first file on List
sel 1,1;
// start the loop if there's a file to move...
regexreplace $next, <curitem>, "^$", "_Done";
regexreplace $next, $next, "^((?!_Done).)*$", "_Loop";
sub $next;
"_Loop"
// our file
set $file, <curitem>;
set $folder, <datem yyyy-mm>;
// Show folders
setting "HideFoldersInList", 0;
// Select All Files
sel f;
// Invert Selection
sel i;
// Copy Name(s)
#102;
set $all_folders, ":<clipboard>:";
// Hide folders
setting "HideFoldersInList", 1;
// Select first file on List
sel 1,1;
// Make sure destination folder exists
replace $all_folders, $all_folders, <crlf>, ":";
strpos $pos, $all_folders, ":$folder:";
// If not an existing folder, create it
regexreplace $next, $pos, "^-1$", "new ""$folder"", dir;";
regexreplace $next, $next, "^((?!new ""$folder"", dir;).)*$", "incr $void;";
load $next,,s;
// move current item
moveto "<curpath>\$folder\", $file;
// Hide folders
setting "HideFoldersInList", 1;
// Select first file on List
sel 1,1;
// continue loop if there's a file to move...
regexreplace $next, <curitem>, "^$", "_Done";
regexreplace $next, $next, "^((?!_Done).)*$", "_Loop";
sub $next;
"_Done"
// done
status "Finished!"
"_nothing"