Clients are always sending us CD’s jam packed with meticulously named jpgs. It’s great that they’ve put all that time into organizing their files – it helps! – but you almost never get a CD that doesn’t have at least a few web-unfriendly characters scattered among those descriptive filenames.
In hopes that it’ll be handy to someone, somewhere, someday, here’s a fun little PHP CLI (!!) tool that takes a directory of images and removes spaces and parentheses, the two most common culprits of brokenness on the web when it comes to unix compatible filenames. The script takes exactly one (optional) argument, specified by the -p flag – the path to the directory you want the script to operate on. (That’s right, this baby works recursively!)
I actually can’t take any of the credit for this one. It’s all Tim’s doing. All I did was add the path flag/CLI stuff. Just download the file at the link below, rename with a PHP extension, and place in a convenient location.