I have a load of deep directories containing a mixture of file types. I want to separate out the files by type, but retaining the directory structure.
So for example I have:
web/site1/index.html
web/site1/image.jpg
web/site2/index.html
web/site2/image.jpg
And I want:
html/site1/index.html
html/site2/index.html
images/site1/image.jpg
images/site2/image.jpg
I found this ancient thread: Copy/Move specific files to an identical folder structure
Is there a better way to do this 13 years later? I've got about 2.7TB of files so I'd prefer to rename (move) them rather than copy and delete them.
It's a 10 minute job in C# but I thought Opus might be able to do it.
Leo
January 23, 2018, 10:09pm
2
That should be fairly easy with a rename script. Just have the script code look at the extension and choose a folder to move (rename) the files into.
If you want help writing the script, please give a full specification of what you want it to do, including all the different extensions and directories they should go in, and an example before & after list of paths.
Jon
January 23, 2018, 10:17pm
3
Possibly this script might already do what you want (or not need much modification):
This requires Opus 12.0.8 or above as it uses the new $.\ feature which makes it easier to move things into sub-folders of the starting point.
Before:
[image]
After:
[image]
What the rename dialog looks like:
[image]
The script code:
fun…
Thanks. I thought about adapting that script, but in the end just wrote this: https://github.com/kuro68k/FileSieve