I am trying to create a .bat that will move,copy, rename (filename - date)
I have got so far and the files move successfully but the rename doesnt seem to work - i dont get any error messages back though.
The rename above would have produced duplicate names ( the system would not allow.)
The following uses the original name as part of the following new name.
( now the name is too long. ). Play with it to reduce name size. Good luck. )
for /f "delims=" %%a in (arc.txt) do (ren "c:\batch\archive\%%a" "%%a %dd%%mm%%yy%.txt" )
C:\batch>kizzie.bat
c:\batch\backup\liz1212.txt
c:\batch\backup\liz1213.txt
2 file(s) copied.
Date = Sun 12/13/2009
mm =12
dd =Su
yy =2009
Volume in drive C has no label.
Volume Serial Number is F4A3-D6B3
Directory of c:\batch\archive
12/13/2009 06:01 PM <DIR> .
12/13/2009 06:01 PM <DIR> ..
12/13/2009 12:25 PM 13 liz1212.txt
12/13/2009 12:25 PM 13 liz1213.txt
12/13/2009 12:25 PM 13 Su12 2009.txt
3 File(s) 39 bytes
2 Dir(s) 305,543,217,152 bytes free
Volume in drive C has no label.
Volume Serial Number is F4A3-D6B3
Directory of c:\batch\archive
12/13/2009 09:03 PM <DIR> .
12/13/2009 09:03 PM <DIR> ..
12/13/2009 12:25 PM 13 liz1212.txt Su12 2009.txt
12/13/2009 12:25 PM 13 liz1213.txt Su12 2009.txt
12/13/2009 12:25 PM 13 Su12 2009.txt Su12 2009.txt
3 File(s) 39 bytes
2 Dir(s) 305,543,213,056 bytes free
C:\batch>
p.s. A full path to the name ( for ren ) of the original file works best. The file with the new name must remain in the same folder. copy or xcopy are more versatile.