1.

Solve : Creating different version in a folder?

Answer»

Hi All,

   I have a batch script which will create a folder in 20100810(yyyyddmm) format. Here is my below requirements

1. We have some files which is modified in daily basses, so i will be creating the folder as above and copy the modified into the newly created folder using a batch file.

2. But now a days modification of files are increases(UPTO 5 times or more). according to the changes i need a batch script to check the folder for that day is created are not? If so we need create a folder inside the 20100810 folder LIKE version(20100810-v1). At the end of the day we can see how many versions(changes) are done.

Please help me on this.

Thanks & Regards
PaulwintechThis little spit of CODE might help:

Code: [Select]echo off
setlocal enabledelayedexpansion

set folder=c:\temp
set yy=%date:~10,4%
set mm=%date:~4,2%
set dd=%date:~7,2%

:loop
  set /a seq+=1
  if exist %folder%\%yy%%mm%%dd%-V!seq! goto loop
 
MD %folder%\%yy%%mm%%dd%-v%seq%

My system date format is dow mm/dd/yyyy. You may have to tweak how yy, mm, dd are assigned. Also change the folder value to something that matches your environment.

Not for nothing, but why not simply concatenate the time to the date and name your folders that way. Just a thought.

Good luck.  Thank you very much.....

Regards
Paulwintech



Discussion

No Comment Found