I'm tring to sort out large collections of files and folders alphabetically. ones that start with a number go to folder "0" those with a letter got to a folder with the same letter.
I've tried copy and rename methods and cannot get any to work.
What I have so far:
@confirm:Really sort to alphabetical folders?
@runonce
Select NONE
createfolder "0|Q|W|E|R|T|U|I|O|P|A|S|D|F|G|H|J|K|L|Z|X|C|V|B|N|M" NOSEL
Rename PATTERN "(\d.+)" to "0\\\1" REGEXP
Rename PATTERN "(\D)(.+)" TO "\1\\\1\2" REGEX
I've also tried:
Rename PATTERN "(\d.+)" to "0/\1" REGEXP
Rename PATTERN "(\D)(.+)" TO "\1/\1\2" REGEX
I'm a long term Dops5 user and this new windows stuff really confuses me, on my amiga I would use something like:
rename [1-9]* as 0/*
rename a* as a/* ;one line for each letter, ugly but it works in dopus or dos.
Execelent! it works, as my previous attempts might have after changing select to all, I forgot I wasn't working on an entire folder just the selected items,I assumed a * wildcard would pick all files in the folder doh!
anyway, my menu entry is now:
@confirm:Really sort to alphabetical folders?
@runonce
Select ALL
Rename PATTERN=* TO="{=f=Left(Trim(file), 1); IsDigit(f) ? "0" : f=}\*" IGNOREEXT AUTONUMBER
No need to select anything, you can tell the Rename command to work on all items. (Although I am not sure that's really a good idea here, as it would move any letter folders that already exist into themselves.)
Please check out Formatting tips specific to the Opus forum for how to post code blocks without characters like \ and * causing problems (and so I don't have to keep editing your posts :))