cw-it
asked on
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.
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.
ASKER
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
set dd=%date:~0,2%
set mm=%date:~3,2%
set yy=%date:~6,4%
md %dd%-%mm%-%yy%
cd %yy%-%mm%-%dd%