Hello Dopus/Coding Experts,
Can anyone help me with this much needed code please?
I currently use:
@nofilenamequoting
@set dir={dlgstringS|Enter name of folder to move selection into|{file|noterm|noext}}
Copy MOVE TO="{sourcepath$}" CREATEFOLDER="{$dir}"
This pops up a dialog with the first selected file name inserted. I delete the last 4 characters and click OK. This creates the folder and moves all selected files into it.
What I would like is for no dialog to open and for it to just remove the last 4 characters on it's own, then move the files as before. It would be nice if it ignored case sensitivity for moving all files and would work when a bunch of mixed names are selected.
Example filenames that would be selected:
Apple-Tree-Cat-Dog-1-001.jpg
apple-tree-cat-dog-1-050.jpg
Apple-Tree-cat-Dog-14-097.jpg
Apple-tree-Cat-dog-14-342.jpg
apple-Tree-swimming-Pool-08-094.jpg
apple-Tree-Swimming-pool-08-689.jpg
From the names, 3 folders would be created:
/Apple-Tree-Cat-Dog-1/
/Apple-Tree-cat-Dog-14/
/apple-Tree-swimming-Pool-08/
All the files with the same base name (full name minus the Extension and last 4 digits) would be moved into their respective folders.
I was able to create a Regex that selects the last 4 digits (-[0-2]\d{2})
but now I'm lost. I can't figure out how to mark all the rest of the name as group1 nor would I be able to figure out how to make it all work in a button. Or if this method is even the correct direction to go.
Thanks for any help!