Using Robocopy to Exclude a File Extension from the Root Directory

I have a directory that I want to copy to another directory using Robocopy.exe.

My plan is to exclude several files from the root of the source directory. In fact, I would ONLY exclude .html files from the ROOT directory.

The trick is that I'm currently using / E, which currently causes all subfolders to be processed.

Therefore, the current result of my operation is that if I use:

/E /XF "*.html"

I am going to exclude all HTML files for the entire site.

Is there a way that I can continue to copy all subfolders, but also use XF to exclude .html files from the root?

Sort of:

/E /XF "c:\releases\website_source\*.html"
+5
2

, . . Robocopy ( ) - .html . Robocopy, ( *.html)

+4

, - .

"" powershell, .

, powershell :

$files = Get-ChildItem c:\releases\website_source -Filter {*.html}
"/XF" > c:\temp\exclude.rcj
foreach ($f in $files) {$f.FullName >> c:\temp\exclude.rcj}

/XF "robocopy". robocopy , /job:c:\temp\exclude.rcj . /XF HTML script.

, , powershell, ..

, , , - .

+3

All Articles