Replace characters in filenames with Batch
 
I had the problem that the character "-" had to be changed to "_" in multiple files.
The 2 batchfiles below can apply this procedure to all files in theyr folder:

_go.bat
dir /B > filelist.txt
FOR /F "tokens=1" %%i IN (filelist.txt) do (
call _rename.bat %%i
)
del filelist.txt


_rename.bat
set name=%1
set newname=%name:-=_%

rename %name% %newname%


Example usage:
1) Create _go.bat and _rename.bat (with the above code inside) and put them into a folder.
2) Put some files in this folder, for example test-1.txt, test-2.txt and test-3.txt.
3) Execute _go.bat (double click it).
4) Your files will be renamed to: test_1.txt, test_2.txt and test_3.txt.
 
admin / Oct 31, 2005
   
 
 
Login: 
Pass: 
 
 
     
     
2004 - 2019 / lookass.ch
makememad@lookass.ch