XCopy folder from source to destination

Need help with a bat script to copy a folder from the C drive to another location on the C drive with the date.

Example:
Source - C:\Backup DB
Target - C:\Archive

I want to take the entire folder "C:\Backup DB" and put that into the C:\Archive with timestampe to the "Backup DB" folder.

The "Backup DB" gets updated with a new DB backup in there nightly.  I want to take the entire folder and just give it a date in the folder name.

Result:
C:\Archive\Backup DB 12-09-2011

Here's what I tried:

XCOPY "C:\Backup DB" "C:\Archive\Backup DB %DATE% %TIME%" /S /I

I'm not getting the date format I need and it's not copying the files inside of the folder "Backup DB".

holemaniaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Lee W, MVPTechnology and Business Process AdvisorCommented:
The variables for both date and time contain invalid characters for a file name. Try using
%date:/=-% and %time::=%

There are other ways to do this as well - that's the quick and dirty. Your basically saying to replace / with - for the date and replace : with nothing for the time (the time would end up looking like 123456.78 hhmmss.Hundreths of a second)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
holemaniaAuthor Commented:
Thanks that works.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft DOS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.