So I want to build a script which copies data from my drive to my USB-Stick. However it should copy it to a specific USB-Stick. To do this I put a .txt file on the stick. If the stick has this specific .txt file it should copy it to that stick where the file is. However how do I set in Robocopy the source and destination?
FOR %%i IN (D E F G H I J K L M N O P Q R S T U V W X Y Z) DO IF EXIST %%i:\ usb_stick.txt SET USBST=%%i: robocopy.exe %USBST%\ "E:\Data\USB Stick" /MIR
Would really appreciate the help, thank you!
How do i use RoboCopy where the destination is pinpointed with the name of a file?
Moderator: DosItHelp
-
- Posts: 1
- Joined: 05 May 2021 12:03
Re: How do i use RoboCopy where the destination is pinpointed with the name of a file?
Code: Select all
FOR %%i IN (D E F G H I J K L M N O P Q R S T U V W X Y Z) DO IF EXIST "%%i:\usb_stick.txt" robocopy "%%i:\." "E:\Data\USB Stick" /MIR
Steffen