I'm trying to find files that end with one-to-four numbers, after a dash.
FileName-7.ext
FileName-50.ext
FileName-429.ext
FileName-8136.ext
...and then I want to replace(remove) the dash and the numbers.
FileName.ext
FileName.ext
FileName.ext
FileName.ext
I've tried searching for the answer/example here, and I've poked at the RegEx, but I suck with it.
I used HandBrake a few years ago to batch convert videos, and it appended incrementing numbers onto everything it output (I've since figured out how to stop that), and I sorted all those videos into a lot of different folders, and I'm just trying to clean the names up.
Finding files that end with Digits, after a Specific Character...
Finding files that end with Digits, after a Specific Character...
Last edited by crimzind on Sun Jan 28, 2024 11:27 pm, edited 1 time in total.
Re: Finding files that end with Digits, after a Specific Character...
This should list the files ending in -<number>.<extension> :
Everything has a feature to rename and even move these files in one go. To rename these files:
If the files needs to moved to a different folder, more information is needed, like the structure of the paths currently used as well as the new destination of the files.
Regular Expression Syntax
Code: Select all
"C:\your starting folder\" regex:"^.*-\d{1,4}\.[^.]+$"
Everything has a feature to rename and even move these files in one go. To rename these files:
- Use the search above to find all matching files
- Select all files (CTRL + A)
- Menu => Edit => Advanced => Advanced Rename
- In the Rename dialog, enable Regular Expressions
- Old format = ^(.*)-\d+\.([^.]+)$
- New format = \1.\2
- In the New Filenames list, check if the filenames are formatted as expected
- If all OK. press the OK button
- Done!
If the files needs to moved to a different folder, more information is needed, like the structure of the paths currently used as well as the new destination of the files.
Regular Expression Syntax
Re: Finding files that end with Digits, after a Specific Character...
This is helping tremendously. Thank you, you're awesome.
The main thing I'd warn anyone using this for similar purposes about is to be aware of files that have Dates at the end in ##-##-##, ##-##-####, or ####-##-## styles.
The main thing I'd warn anyone using this for similar purposes about is to be aware of files that have Dates at the end in ##-##-##, ##-##-####, or ####-##-## styles.