Jump to content


  • 0
repacker

Robocopy script

Question

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

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

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

Share this post


Link to post
Share on other sites

  • 0

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.

Share this post


Link to post
Share on other sites

Join the conversation

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

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.