I have multiple videos, and they all have different titles to them. For example one is called The_Speaker's_Wrath_1982_, another is called Forest_Spirit_1977_ and they all have different titles but look like that..with the underscore's. I was wondering if it's possible to rename all the videos I have, to like The Speaker's Wrath (1982), Forest Spirit (1977) to rename them like that. It prolly looks stupid, but if it can be done that would be cool. Thanks for the help.
Asked
Active
Viewed 967 times
-1
-
What operating system are you on? – Manav Kataria Nov 13 '13 at 03:41
-
1this should be a trivial request for someone with knowledge of powershell (which you have available by default in windows 7). tag your question with powershell and see if you get a response. – dav1dsm1th Nov 13 '13 at 05:59
1 Answers
1
Supposing are all .avi files and all in one folder you can do that in a powershell console from that folder:
get-childItem *.avi | rename-item -newname { $_.name -replace '_',' ' -replace '\d{4}', '($0)' }
side note: if the title contains a number of 4 digit it will be enclosed in ()
too.

CB.
- 58,865
- 9
- 159
- 159
-
The video files are multiple formats sometimes, like .avi, .mp4, .wmv, .mkv and so on. But how would powershell know to rename the item properly? – milktruck Nov 13 '13 at 08:30
-
1If you isolate all of the videos into the same folder (I think you may already have done that) you should be able to change the `*.avi` to `*.*` (towards the beginning of the powershell command) so that it will look at all files in the folder (rather than just .avi files). – dav1dsm1th Nov 13 '13 at 08:44
-
you may need to adjust the `'\d{4}'` towards the end of the command with `' \d{4} '` so that the spaces around the 4 digit number are included in the text that gets replaced with the number in parenthesis. I would recommend copying a few files into a separate folder to experiment on before running the command on the entire folder (you ought to have a backup of the files - just in case anything goes wrong). – dav1dsm1th Nov 13 '13 at 08:55
-
1@C.B.,dav1dsmi1th: Moving files would prove a problem for me as they often have associated nfo,tbn,jpg. You can avoid this by using the following instead: `code Get-ChildItem -Path "C:\videos" -Include @("*.avi","*.mp4","*.mkv","*.wmv") ` – Robin Nov 13 '13 at 11:49
-
So how would the full command look, C.B.,dav1dsmi1th..with your line added in? I'm confused..sorry – milktruck Nov 14 '13 at 04:00
-
`get-childItem -Path "C:\videos" -Include @("*.avi","*.mp4","*.mkv","*.wmv") | rename-item -newname { $_.name -replace '_',' ' -replace '\s\d{4}\s', '($0)' }` you substitute the path to your folder for c:\videos and add any other video formats in the set between the brackets – dav1dsm1th Nov 14 '13 at 22:51