0

I'm doing a data entry job and I need to rename all the images inside a bunch of folders. Instead of doing it manually I thought PHP could help.

Inside each folder is an image. I need to loop through all the folders, grab the image and rename it to it's parent folder's name. I know it's 100% possible but I'm not sure how to go about it.

Thanks!

user990717
  • 470
  • 9
  • 18

1 Answers1

0

You have to use two php's function: scandir and rename.

scandir: list all files of a directory

http://www.php.net/manual/pt_BR/function.scandir.php

Then, with "foreach", you can rename each file using rename

http://php.net/manual/pt_BR/function.rename.php

Good look!!!

jkamizato
  • 196
  • 5