|
Answer» Hi,
I am trying to create a batch file to do the following:
1) Create a directory with today's date as the name, eg C:\backup\2006-07-26\
2) Copy files from a list of directories into the new directory (ideally, the list of directories will be held in a file)
3) ZIP the new directory into 2006-07-26.ZIP
4) Transfer the file to an FTP site.
I'd REALLY appreciate your help in building this batch file. Even if you can only supply ONE part of it, it'd be a great help - perhaps someone else will supply another part.
Once it's done, I'll post the completed batch here for anyone else to use.
Thanks in advance for your help!
Mr_T So far, I've worked out how to create the directory with today's date:
@ECHO OFF CLS ECHO ================================================== ECHO NIGHTLY BACKUP ROUTINE v1.0 ECHO ================================================== ECHO. ECHO 1) Creating temp directory with today's date SET DATEDIRNAME = %DATE:~6,4%-%DATE:~3,2%-%DATE:~0,2% MKDIR %DATE:~6,4%-%DATE:~3,2%-%DATE:~0,2% ECHO DONE! ECHO. ECHO 2) Copying files for backup into temp directory Let's say the directory list is stored in directories.txt then use this:
for /f "TOKENS=*" %%a in (directories.txt) do xcopy "%%a" "%DATEDIRNAME%" /s /y
Hope this helps.
|