I have 2800 files, all of whose names start with a four-digit number followed by " - ", and I want to delete all those leading numbers from all the files, leaving only the alphanumeric file names1.
How can I do this?
________________
1 Some of the filenames contain numerals after the " - ".
Asked
Active
Viewed 797 times
0
2 Answers
2
PowerShell! Something like this should do what you want it to do. It will take teh first 7 characters off of the file name and rename it (7 characters is 4 digit number + 1 space + 1 hyphen + 1 space)
This relies on you having a definite pattern of "0000 - " before the filename and won't play nicely if it results in duplicate file names, but is a good jumping off point.
Get-ChildItem -LiteralPath "D:\bigfolderofstuff\" | ForEach {
Rename-Item -LiteralPath $_.FullName -NewName ($_.Name).Substring(7)
}
Fazer87
- 12,965
0
If you are running windows, In the past when I encounter similar problems I have used "Batch renaming tool" with considerable success.
Can be downloaded here, it is free and it works:
