I'm trying to write a robocopy script which will copy all error files, regardless of what subfolder they are in, to one location.
I've done robocopy "C:\ProgramData\Microsoft" "D:\ErrorLogs" *.err /s, but that also copies the subfolder over.
I want all of the .err files to be in D:\ErrorLogs, regardless of whether they were originally in a subfolder or not.
Is that possible?
I am not sure that
Robocopy.exewill ignore subdirectory paths. There will likely be directories and/or file that cannot be accessed, so-ErrorActioncan be used.