Batch renaming 32000 files - splitting into multiple subdirectories
Posted
by Gareth
on Server Fault
See other posts from Server Fault
or by Gareth
Published on 2010-06-14T10:58:23Z
Indexed on
2010/06/14
11:03 UTC
Read the original article
Hit count: 290
I've got a web server which has files uploaded to it. There is a script which assigns them numeric IDs and stores them in a corresponding subdirectory.
I've now got 32000 of these uploads and that's too many for the server to handle in one directory. The script I'm using does have a way to "namespace" uploads so that ID 12345 - instead of sitting in /files/12345
- would sit in /files/namespaced/000/012/345
.
The code can deal with this just fine, but I now have 32000 subdirectories in the wrong naming style. What's the easiest way to go through my existing files and put them in the right place?
© Server Fault or respective owner