I have a subdirectory with a 1000 files in it named:
I need to rename them to the same names less 1000
so they become:~
What would be the best way to do this in a simple php script
that will step through the sub-directory files ?
By the look of it you could use
glob() to retrieve a list of files and then process them, or
scandir() to read through the directory. Either would allow you to retrieve all the names, then you can loop through each one, split the name, deduct the 1000 from the first part, rebuild the new name, then rename the file. If you already know the filenames you could just loop and rename, my preference though would be to base it on what’s there.
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.