|
Answer» I want to change the FILENAME of all files in a folder where no TS file exist into XML file For example: when the file test.xml EXISTS and the file test.ts doesn't exist I want to rename the file test.xml to test.ts I tried this batch but it doesn't work. The batch do nothing.
FOR %%G in (*.xml) do if not exist "%%~nG.ts" rename "%%~nG.xml" "%%~nG.ts"
Any ideas?Try RUNNING this and see what messages you MAY get
echo off FOR %%G in (*.xml) do ( echo Found: "%%~nG.xml" if not exist "%%~nG.ts" ( echo "%%~nG.ts" does not exist echo Trying to rename "%%~nG.xml" to "%%~nG.ts" rename "%%~nG.xml" "%%~nG.ts" && (echo Success) || (echo Fail) ) else ( echo "%%~nG.ts" ALREADY exists ) ) echo Finished pause
|