Solved

Batch file to copy directory with date stamp

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

cPanel is a Unix based web hosting control panel that provides a graphical interface and automation tools designed to simplify the process of hosting a web site. cPanel utilizes a 3 tier structure that provides functionality for administrators, rese…
Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

947 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

20 Experts available now in Live!

Get 1:1 Help Now