Solved

Batch file to copy directory with date stamp

Posted on 2007-03-30
3
1,751 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Comparison of Amazon Drive, Google Drive, OneDrive

What is Best for Backup: Amazon Drive, Google Drive or MS OneDrive? In this free whitepaper we look at their performance, pricing, and platform availability to help you decide which cloud drive is right for your situation. Download and read the results of our testing for free!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
preview video of network plus 2 151
How to run a .bat file from a no name folder 5 70
How do I delete 2 44
How to convert Excel file to Text file 9 66
Migration of Exchange mailbox can be done with the ExProfre.exe tool. But at times, when the ExProfre.exe tool migrates the Exchange Server user profile, it results in numerous synchronization problems. Synchronization error messages appear in the e…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
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…
Suggested Courses

739 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