Page 1 of 1

Batch file to get rid of spaces in ROM filenames

Posted: Mon Dec 31, 2018 2:13 pm
by NoJive
If anyone has a crap ton of ROMs that will not scan due to spaces in the filenames, this might just help out. Make a batch file with the following text, and put the file in whatever ROM directory you want changed. This replaces spaces in the names with underscores, and will do this on every file in the directory. If you want to force it to only change, say .zip files, you can do this by replacing the *.* with *.zip, or whatever extension you wish:

Setlocal enabledelayedexpansion

Set "Pattern= "
Set "Replace=_"

For %%a in (*.*) Do (
Set "File=%%~a"
Ren "%%a" "!File:%Pattern%=%Replace%!"
)

Pause&Exit

Re: Batch file to get rid of spaces in ROM filenames

Posted: Tue Jan 01, 2019 2:05 pm
by dee2eR
Thanks for posting that, great idea. It's probably also useful for images. With some tweaking it could be worth adding that as an option in the service menu (although could also be disastrous if it goes wrongly...)

Re: Batch file to get rid of spaces in ROM filenames

Posted: Tue Jan 01, 2019 2:08 pm
by guntherm
I like that idea of adding it.. but you are right.. could be harmful.. lol

Re: Batch file to get rid of spaces in ROM filenames

Posted: Thu Jan 03, 2019 2:39 am
by NoJive
dee2eR wrote:
Tue Jan 01, 2019 2:05 pm
Thanks for posting that, great idea. It's probably also useful for images. With some tweaking it could be worth adding that as an option in the service menu (although could also be disastrous if it goes wrongly...)
No problem! It does work well...fixed my ROM issues for sure!