How to recursively delete directories skipping some directories/files from command line in windows?

1

Suppose I have a complex path of directories:

<ROOT>
  folder1
  folder2
    sub1
    sub2
  folder3
    sub1
    sub2
    ...

and suppose in some folders there are files named "skip.me"

How can I delete all content in all "folderX" directories skipping the "skip.me" files (and their containing folder)?

Gianpiero Caretti

Posted 2016-04-12T13:20:47.090

Reputation: 131

Answers

0

I found the solution using the powershell command "rm":

rm "folder*\*" -recurse -force -exclude "skip.me"

Gianpiero Caretti

Posted 2016-04-12T13:20:47.090

Reputation: 131