PHP implementation of the bulk modification of the file suffix name method,
In this paper, we describe the method of PHP to implement batch modification of file suffix name. Share to everyone for your reference. Specific as follows:
/** * Bulk Modify file suffix name * @param $path folder path * @param $sext original file suffix ($sext =all all files throughout the directory) * @param $dext destination file suffix * @return void
*/function Foreachdir ($path, $sext, $dext) { $handle =opendir ($path); if ($handle) {while (false!== ($file = Readdir ($handle))) { if ($file! =). "&& $file! = ' ... ') { if (Is_dir ($path. $file)) { Foreachdir ($path. $file); } else{ $ext = Strripos ($file, '. '); $fileName = substr ($file, 0, $ext); $SRC = $path. ' /'. $file; $dest = $path. ' /'. $fileName. '. $dext; if ($sext! = "All") { if ($sext = = substr ($src, 0-strlen ($sext))) rename ($src, $dest); } else{ Rename ($src, $dest); }}} return false; } }foreachdir (' C:\Users\chenlinzhong\Desktop\redis-stable\src ', ' C ', ' txt ');
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/1040823.html www.bkjia.com true http://www.bkjia.com/PHPjc/1040823.html techarticle PHP Implementation of the method of batch modification of file suffix, this article describes the PHP implementation of bulk modified file suffix method. Share to everyone for your reference. Specific as follows:/** * Batch repair ...