|
Answer» I am new to the forums and I have recently started working with bat files, so please bear with me. I am using Windows 7 and currently have a batch file that pulls reports and stores them in a directory that we will call "C:\My Document\Current Reports". Inside the Current Reports directory, I have another directory that is labeled Archives, and inside Archives are the folders labeled by months as shown below. Each day my batch file pulls new reports and moves yesterday's reports to the archive FOLDER. Rather than STOPPING there, I am wanting it to place the folder into the current month. I have a folder for each month labeled as follows:
1. January 2. February 3. March 4. April ...etc
Directories described above
C:\My Documents\Current Reports C:\My Documents\Current Reports\Archives C:\My Documents\Current Reports\Archives\"Folder labeled by month"
I know it has to be simple FOR command, but I can't quite figure it out. Any assistance would be GREATLY appreciated.I think you can adapt the following to suit your needs:
Code: [Select]SET MO=%DATE:~4,2% IF %MO%==01 SET FOLD=1. January IF %MO%==02 SET FOLD=2. February IF %MO%==03 SET FOLD=3. March IF %MO%==04 SET FOLD=4. April IF %MO%==05 SET FOLD=5. May IF %MO%==06 SET FOLD=6. June IF %MO%==07 SET FOLD=7. July IF %MO%==08 SET FOLD=8. August IF %MO%==09 SET FOLD=9. September IF %MO%==10 SET FOLD=10. October IF %MO%==11 SET FOLD=11. November IF %MO%==12 SET FOLD=12. December ECHO %FOLD%WOW! Thanks a million. That worked beautifully. I also learned a LITTLE bit when messing with that code. Rather than asking the question here, I will create a new thread. This one is SOLVED. Thank you once again!.
|