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 box) 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??).
<?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."; ?>
You need to login to post a comment.
