Adding condition to existsing DOS Script which adds file extension and replaces characters
Posted on 2007-03-22
In a dos batch script I use this command to rename files to use the extension of .xml
for %%a in (*.*) do ren %%a %%a.xml
I also use a second batch file to replace any . character with an _ character...
for /f "tokens=*" %%a in ('dir %source% /a-d /b') do call :process %%a
rename %source%\%fname% %fname:.=_%
Would I need to do is two things...
1) Only add the .xml file extension if the file does not already have a .xml file extension
2) Incorporate both scripts together so its all one process
So the end result is hopefully a file with .xml as the file extension with only the . character before the xml file extension, any other would have been changed to _
Can anybody assist?