Robocopy /IF syntax doesn't match /XF syntax

99 Views Asked by At

I've been trying to figure this out, and I am looking for someone to confirm for me that robocopy wildcards will NOT allow you to filter/include files (/IF) that CONTAIN a series of characters, but they will allow you to exclude files (/XF) that do.

As far as I understand you can use the * wildcard to filter files that START with a character or series of characters (*a, or *april would return April_sales.xls, but not SalesSummary_April.pdf), and you can use the same * wildcard to filter for file extension (*.xls).

I want something like *apr* to return files April_sales.xls, SalesSummary_Apr.pdf, and Paprika.jpg, but as far as I can tell, it's not possible.

However, that is exactly what the /XF syntax does, so it seems like it should be possible...

Can someone point me in a direction that will explain this or confirm this explicitly for me?

Edit: My actual robocopy script has nothing to do with 'apr' as you can see below - I'm trying to grab all pdfs that have 1016-N11 or 1016-C14 within the filename and exclude all other files in the directory that it comes across. Technically I don't even think I need to exclude (/XF) .jpg files but the *.pdf filter (/IF) doesn't even work.

robocopy $remoteBasePath $homeBasePath /L /IF *1016_N11* *1016-N11* *1016-C14* *1016_C14* *.pdf /XD *Calculations* *archive* /XF *.jpg

Thanks for your help folks!

0

There are 0 best solutions below