.bat file question / help (copy to usb)

Associate
Joined
5 Jun 2004
Posts
890
Location
Yorkshire
Hi guys I am looking for a simple script that a user can run to copy files from a local machine to a USB pen drive (f:). However I am not sure if its possible to script that if it detects another folder in the same destination with the same name then it asks the user what it should call this folder.

The idea behind it is that I want a end user to backup a specific folder to the USB every time they use it, but I would rather have a new folder name each time with the user specifying the date after the folder name.

Is that possible?

thank you.
 
Robocopy would do this all apart from popping up with a dialog box asking you to rename the new folder.

I currently use robocopy to constantly search a folder from one FTP server and moves it to another while deleting at source. These are files within a folder though, not the folders themselves.
 
Code:
md "X:\Backup\%date:~6,4%-%date:~3,2%-%date:~0,2% Name"

robocopy /e "c:\source folder" ""X:\Backup\%date:~6,4%-%date:~3,2%-%date:~0,2% Name"


md = creates the folder
robocopy = copies the files/folders/subfolders


%date:~6,4%-%date:~3,2%-%date:~0,2% translates as 2015-25-12 (but today's date)

If you run this twice in one day, it will only copy the updated and new files.




To test the output, type in.. cmd..

echo %date:~6,4%-%date:~3,2%-%date:~0,2%
 
Back
Top Bottom