Solved

Batch file to copy directory with date stamp

Posted on 2007-03-30
3
1,745 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:
Bartender_1 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Can you find a fax from a vendor you saved a decade ago in seconds? Have you ever cursed your PC under your breath during an audit because you couldn’t find the requested statement or driver history?  If you answered no to the first question or yes …
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

707 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now