Hi,
I am new to DOS programming and have another renaming question. I realize that there are a lot of renaming posts out there, but I have not found one which addresses my issue.
I basically need to rename all files in a folder by pre-pending them with the folder name, i.e. C:\Test\File.tif becomes C:\Test\Test-File.tif.
I have come up with the following code and it comes close to working
for %%a in ("%CD%") DO SET CurrentFolder=%%~na
for %%B in (*.tif) do rename %%B %currentFolder%-%%B
Run against the following files I get the following results:
C:\CSCAN\FILE1.TIF becomes C:\CSCAN\CSCAN-CSCAN-FILE1.TIF
C:\CSCAN\FILE2.TIF becomes C:\CSCAN\CSCAN-FILE2.TIF
C:\CSCAN\FILE3.TIF becomes C:\CSCAN\CSCAN-FILE3.TIF
Does anybody have an explanation for what is going on here?
Thanks in advance.
Bob