By the look of it you could use glob() to retrieve a list of files and then process them, or opendir() and 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.