Q
2024-01-30 19:56:02 UTC
I am trying to robocopy all the folders in a folder which start with
"P-" to a network share. I understand Robocopy does not work using
wildcards in the source folder. How can I do this in a batch using a
For command? I tried
For /d %%a in ("d:\folder source\P-*") Do Robocopy "%%a" "\\unc path to
folder\data\%%a" /variousrobocopyswitches
but %%a is picking up the entire path and trying to use it as the
destination. I only need the folders that start with "-P" to be copied
to the "data" folder that lives in the destination path. How do I
separate the "P-" folders found from the source path?
"P-" to a network share. I understand Robocopy does not work using
wildcards in the source folder. How can I do this in a batch using a
For command? I tried
For /d %%a in ("d:\folder source\P-*") Do Robocopy "%%a" "\\unc path to
folder\data\%%a" /variousrobocopyswitches
but %%a is picking up the entire path and trying to use it as the
destination. I only need the folders that start with "-P" to be copied
to the "data" folder that lives in the destination path. How do I
separate the "P-" folders found from the source path?