I am trying to use the /if (Include Files) flag for robocopy to provide an array list of all the files I would like to copy.
I successfully did this when setting the source directory just 1 level up (e.g. C:\Documents\Folder), and providing just the filename in the array after /if (e.g /if file1).
However, when I try to set the source directory 2 levels up (e.g. C:\Documents) and pass the entire filepath into /if (e.g if/ C:\Documents\Folder\file1 [no extension on these files]), the robocopy will not recognise the entire filepath as a valid parameter. I tried with just one filepath instead of an array, and multiple ways of inputting this such as with double quotes around the filepath, but still errored with invalid parameter.
To test, I tried to do the opposite with /xf, and the robocopy then excluded this file successfully.
Is this a limitation of the /if flag for robocopy?
robocopy C:\Documents D:\Documents /e /tee etc... /if "C:\Documents\Folder\file1"
Thanks.