Solved

Batch file to copy directory with date stamp

Posted on 2007-03-30
3
1,749 Views
Last Modified: 2008-01-09
Windows 2000 pro and XP Pro

Need to create a batch file that will copy a directory and all contents
to a new directory with the same name plus the date.

Example:
Source directory = DATA
Destination directory = DATA_033007

I will run the batch file every night and backup my data to another drive.

Thx

0
Comment
Question by:Charles_Foote
3 Comments
 
LVL 22

Accepted Solution

by:
Christopher McKay earned 500 total points
ID: 18825506
The following script should work for you.

@ echo off
for /f "tokens=1-4 delims=/ " %%a in ('date /t') do (
  set dow=%%a
  set mm=%%b
  set dd=%%c
  set yy=%%d
)

xcopy <source> <source>%mm%%dd%%yy%



Hope this helps!

:o)

Bartender_1
0
 
LVL 2

Expert Comment

by:altra22
ID: 18825513
Open notepad and write this line
xcopy /e /v /y S:\DATA D:\Backup\DATA_033007
and save it as *.bat then make a schedule to run this file
note that drive S: Source drive and D: destination
for more info http://www.ahuka.com/backup/backup3.html
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Issue: Unstable cursor in Windows XP and Windows runs extremely slow in that any click will bring up the Hour glass (sometimes for several seconds before giving you what you want) . Troubleshooting Process and the FINAL FIX: This issue see…
NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question