- How to rename all files of a directory php.
- Rename all files of a folder with php.
- Bulk file rename with php
This script renames all the files located in a directory. With below given example we can rename all files of a folder to upper case. You may use other combinations to rename files according to your requirement.
Script
$path='photos/products/';
$handle=opendir($path);
while(($file = readdir($handle))!==false){
if ($file!="." && $file!=".."){
rename($path . $file, strtoupper($path . $file));
}
}
Output
IMAGE01.JPG, IMAGE02.JPG

Leave A comment
Email address is optional and will not be published. Only add email address if you want a reply from blog author.
Please fill required fields marked with *