batch file - Skip IF folder name contains "zyx" -
the code below works well, finds latest folder created , adds "- esp" @ end of e.g. folder test123 test123 - esp.
however if chance script executed 1 time again whatever reason, folder looks test123 - esp -esp.
the thought check latest folder has esp in name.
i assume if / else needed not sure if need utilize find command.
for /f "delims=\" %%i in ('dir /b /ad-h /o-d') ( set a=%%i goto :found ) echo no subfolder found goto :eof :found should if / else here?
echo recent subfolder: "%a%" cd %a% %%a in (*) rename "%%a" "%%~na-%a%%%~xa" cd ..\ ren "%a%" "%a% - esp" pause
edit :
for /f "delims=\" %%i in ('dir /b /ad-h /o-d') ( set a=%%i goto :found ) echo no subfolder found goto :eof :found echo recent subfolder: "%a%" if /i "%a:~-3%"=="esp" goto:next cd %a% %%a in (*) rename "%%a" "%%~na-%a%%%~xa" cd ..\ ren "%a%" "%a% - esp" pause exit /b :next echo done this check 3 lastly char of folder.
batch-file
No comments:
Post a Comment