Remove date from end of all file names in folder

Hi there,

I have a folder with a bunch of files in it all of which end with a date “CAN 12-17” or “JPN OCR 06-18”.

is there a way to remove these dates from the end of each file in the folder? I’ve looked through this site and everything mentions to get file names and then use ‘Move File’ to rename the files but I haven’t been able to put it all together.

Appreciate the help!

Do you have any screenshots or .xaml files where you tried to do this, then we can make suggestions on where you went wrong?

Essentially, you are right, you will need to get all the files in the folder, run them through a ForEach loop, and use Move File to make the renames. The tricky part is removing the dates, but you can probably use Regex.Replace for that.

As you can see from the images, I used Regex to detect the date pattern, and combined the directory, the filename without extension (so I could trim the end spaces), and the extension. So, it will rename the file without the date in the pattern 00-00

Regards.

1 Like