Skip to content

Robocopy script

Featured Replies

Hi,

 

I'm searching for a script to delete all files and folders from drive D: but at the same time I'd like to to exclude a few folders and files!

A was looking at Robocopy. Here is my testscript:

 

***************

mkdir C:\DELETE

robocopy "D:\" "D:\DELETE" /E /MOV /NP /XD "Dir 1" "Dir 20 00" "Dir3" /XF "File 1.dll" "File 2 0 .txt" /R:10 /W:30

rmdir "c:\DELETE" /s /Q

*************

 

It creates a directory > copies everything (except the excluded folders and files) to that directory and than it deletes the directory....but

 

It gives back this message:

 

ERROR: Invalid Parameter #4 : "00 Dir3 /XF File"

 

What is the right command line string?

 

Best regards

Hi,

 

I'm searching for a script to delete all files and folders from drive D: but at the same time I'd like to to exclude a few folders and files!

A was looking at Robocopy. Here is my testscript:

 

***************

mkdir C:\DELETE

robocopy "D:\" "D:\DELETE" /E /MOV /NP /XD "Dir 1" "Dir 20 00" "Dir3" /XF "File 1.dll" "File 2 0 .txt" /R:10 /W:30

rmdir "c:\DELETE" /s /Q

*************

 

It creates a directory > copies everything (except the excluded folders and files) to that directory and than it deletes the directory....but

 

It gives back this message:

 

ERROR: Invalid Parameter #4 : "00 Dir3 /XF File"

 

What is the right command line string?

 

Best regards

 

 

can you provide the full path for the file 1.dll after /XF ? something like /XF C:\eskonr\test.txt OR /XF C:\eskonr\test\test.txt

  • Author

can you provide the full path for the file 1.dll after /XF ? something like /XF C:\eskonr\test.txt OR /XF C:\eskonr\test\test.txt

 

Hi Eswar,

 

Thank you for the reply, I'd tried the full path option, with and without quotes but that doesn't work.

I made one step; I decided to test with only one directory and one file and found that the syntasource directory was not correct

 

mkdir C:\DELETE

robocopy "D:\" "D:\DELETE" /E /MOV /NP /XD "Dir 1" "Dir 20 00" "Dir3" /XF "File 1.dll" "File 2 0 .txt" /R:10 /W:30

rmdir "c:\DELETE" /s /Q

 

robocopy "D:\" must be robocopy "D:", now its moving the directories and files to the DELETE directorie. but the script stops because it cannot copy the hidden 'System Volume Informatuion" directory.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.