Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Batch file counter
Name: netwgirl Date: August 20, 2009 at 22:02:27 Pacific OS: Windows XP Subcategory: Batch
Comment:
I am renaming a bunch of .pdf files and I'm having a hard time adding a counter after renaming. Here is what I have so far for my batch file---
Because there are multiple .pdf files and I want them to include the current date it won't rename all of them (obviously because you can't have more than one file with the same name).
Any suggestions on how to add a counter after the current date when renaming?
Name: xterm11 Date: August 21, 2009 at 00:22:48 Pacific
Reply:
Use a for loop instead.
set count=1 setlocal enabledelayedexpansion for /f %%a in (\Company\DM\MC\Backup\09_08_20\*.pdf) do ( rename %%a MC_%YY_MM_DD%!count!.pdf set /a count=!count!+1 )
Something like that
There are no stupid questions, just stupid people.
0
Response Number 2
Name: netwgirl Date: August 25, 2009 at 07:48:49 Pacific
Reply:
I have another question....let's say I didn't want to use a counter-- is there a way to just use the rename command?
Summary: Is it possible to increasement an integer counter in a batch file script? Example: Set Sleep=0 :Rerun osql ... if %ERRORLEVEL%==0 goto :Cont Set Sleep=%Sleep%+1 if %Sleep%==3 goto :ErrorOut goto :Rer...
Summary: I need to create a batch file that will compare files and folders on a server to their counter parts on a workstation and delete anything older than a month. For example i have a workstation with a u...
Summary: this question should be easy, but i am not a programmer. so you may want to talk at a novice level. my problem is this, i need to write a batch file or script that will keep a running count (a batch ...