Create a directory with date and copy data using Robocopy

Hi all, I wonder if you can help. I have created a robocopy script in which I can copy my data from my usb drive to my laptop and it works. I have also told it to create a folder with the current date and place the data on it, however, it creates de folder but does not put the data on the created folder but on the location where the bat file is. Can someone help please?

Also it sets the day on the folder like this 21042010, could this be changed to 21-04-2010?

 The script I have created is the following:

@echo off

set dd=%date:~0,2%
set mm=%date:~3,2%
set yy=%date:~6,4%

md %dd%%mm%%yy%
cd %yy%%mm%%dd%

RoboCopy.exe E:\\ C:\USB-DRIVE *.* /e /zb /eta

Many thanks in advance.
cw-itAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

Johnner_dkCommented:
@echo off

set dd=%date:~0,2%
set mm=%date:~3,2%
set yy=%date:~6,4%

md %dd%-%mm%-%yy%
cd %yy%-%mm%-%dd%
0
cw-itAuthor Commented:
Thanks Johnner, now it creates a folder the way I wanted [ie. 21-04-2010]. However, it creates the folder empty on the desktop, which is where I have the bat file, however, how can I do so that it creates the folder and copy the files to that folder. The folder that it creates currently is empty and not in the right location. It should be created on C:\USB-DRIVE and all the files should have been copy to that folder.
0
cw-itAuthor Commented:
After digging for a while I managed to find the solution.

@ECHO OFF

IF "%1" == "" GOTO CURRENT

%1:

:CURRENT
CD\
CLS
CD C:\USB-DRIVE\

set dd=%date:~0,2%
set mm=%date:~3,2%
set yy=%date:~6,4%

RoboCopy.exe E:\\ C:\USB-DRIVE\%dd%-%mm%-%yy% *.* /e /zb /eta

Thanks for your help!
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
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
Storage Software

From novice to tech pro — start learning today.