A Simple PHP CLI Tool For Cleaning Up Filenames

Aug. 7, 2009

11:10 am

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.

Download now!

Comments

August 13, 2009

12:23 am

I like simple and specified tools. I think that all those too combined applications are just making more mess. There was a time when every program had its purpose but now everything is trying to do everything. And the common law is that if something is trying to be for everything it is probably for nothing. You can focus on one thing and make it perfect or you can try to do many things and be just average in all of them. That is the difference. And I would like to use best programs, so they need to be simple and specified. That is my opinion.

Kotlina Kłodzka (#)

December 17, 2009

2:41 am

I agree that some tools just need to be more effective and less eye-catchy. I like when there are no graphic “cool makers”, and the most of of programmers and protectants strengths were put on making the final product the most reliable.

Pen Tablet (#)

January 2, 2010

4:51 am

Hello guys!

PHP CLI is avaiable on all popular operating systems: Linux, Windows, OSX, Solaris. Popular Linux distibutions (such as Ubuntu, Debian, Fedora Core, Suse and etc.) allow to install PHP CLI from package manager (e.g. Synaptic or similar) with couple of mouse clicks..

Facebook Layouts (#)

Whaddya think?