/ Published in: PHP
Small script to rename files in a given directory so that their extension is lowercase (i.e. example.JPEG becomes example.jpeg). Useful for keeping extensions consistent before uploading to a server with a case sensitive file system.
Note this includes code specifically for PHP on Windows (merely because it was written for use on my local XP machine) which remove the XP-created "Thumbs.db" files. On OS X, the equivalent is .DS_STORE. I don't now about Linux (it probably differs depending on the distribution??).
Expand |
Embed | Plain Text
<?php $root = $_GET['root']; $z=0; for($i=0;$i<count($files);$i++) { if(stripos($files[$i],"Thumbs.db")) { $z++; } else { } } echo "$i files renamed. $z Thumbs.db files deleted."; ?>
Comments
Subscribe to comments
You need to login to post a comment.

hi there... really cool code, it could still use some tweaks though. but this has been a really big help.
check out my mod of the code "http://snipplr.com/view/19822/code-to-change-the-file-extensions-of-images-to-lowercase/"
glad it helped, your code looks useful as it can be adjusted for any extension.