unknownsoldierX Posted June 11, 2012 Share Posted June 11, 2012 I have a bunch of files named "document (1).doc", "movie (1).avi", etc. How do I make a batch file remove the " (1)" from all the files? I've tried getting rid of the (1) using this: rename *(1).avi *.avi[/CODE] That doesn't do anything. I'd like to have a .bat or some other kind of script that I can run manually or using task scheduler. Link to comment Share on other sites More sharing options...
Skyfrog Posted June 11, 2012 Share Posted June 11, 2012 I don't think the Windows command shell is quite advanced enough to do that; Powershell may be but I've never really used it. You can use a free GUI program like this though: http://www.den4b.com...product=renamer By the way, the (1) appears in the first place because a file with that name already exists. Link to comment Share on other sites More sharing options...
yxz Posted June 11, 2012 Share Posted June 11, 2012 SETLOCAL EnableDelayedExpansionfor %%a in (*.avi *.doc) do (set a=%%aif "!a:~-8,-4!"==" (1)" ren "%%a" "!a:~0,-8!!a:~-4!")[/CODE] Link to comment Share on other sites More sharing options...
unknownsoldierX Posted June 11, 2012 Author Share Posted June 11, 2012 Thanks, yxz. That seems to work perfect. That's way beyond my current understanding. Would you mind explaining what all the symbols do? Link to comment Share on other sites More sharing options...
articuno1au Posted June 11, 2012 Share Posted June 11, 2012 I don't know if this tool would help you at all, but I wrote it to do a similar thing :) https://www.neowin.net/forum/topic/996768-i-wrote-a-batch-file-renamer/ It's pretty much does what yxz is doing but in C#. Hope it helps >.< Link to comment Share on other sites More sharing options...
Dick Montage Posted June 11, 2012 Share Posted June 11, 2012 I know you solved your problem, but can I give a huge recommendation to this little app: http://www.bulkrenameutility.co.uk/Main_Intro.php Link to comment Share on other sites More sharing options...
Recommended Posts