so in one other recent question i needed to find a solution to bulk renaming files by adding .ab into the filename. I succeeded in doing that, but now i face a different problem. Every time i run the batch file, it appends .ab to all the files even those, already renamed. I tried fixing the problem in the following way, which doesn't work.
rem @echo off
FOR /R "C:\Users\" %%G in (*.txt) DO (
%%G|findstr /i /L ".ab">nul
IF errorlevel 1 (
REN "%%G" "%%~nG.ab.txt"
) ELSE (
skip %%G
)
)
pause
Essentially i need to check if the file name already contains ".ab" in its name and then either skip or add .ab depending on the result. I would appreciate any help.
Aucun commentaire:
Enregistrer un commentaire