I often need to move files from one location on a server into a set of hierarchical folders.
The filenames are usually 7 digits long – sometimes with some extra characters at the end.
The folders are set up as nested sets for each digit – 3 deep. So, a file named '6753687a.eps' for example would need be filed in the '675' folder, which is in the '67' folder, which is in the '6' folder, which is in the 'Images' folder at the root of the volume. There is no '6753' folder.
Ideally, I'd like to be able to drop groups of files into a folder or a droplet or something, and have the files automatically moved into their correct folders.
Does anyone know of a way to do this?
Best Answer
Automator Droplet
You can do this with an Automator workflow and a script (I'm using Python, but it could be done with Bash, Applescript or anything else really).
/usr/bin/python
, and Pass input: to as arguments.Script
Important: Change the
destinationPath =
line to the path you want (i.e. the folder that contains your numbered folders). Make sure to retain the single quotes around the path.Usage
Just drag and drop the files you want onto the application file you saved, and they'll be moved accordingly. If the proper folders don't exist already, they will be created.