Link to home
Start Free TrialLog in
Avatar of Seth Simmons
Seth SimmonsFlag for United States of America

asked on

robocopy question

I have a question with robocopy that could be very simply that i'm just not seeing...

i want to copy folders from one server to another
the source looks like:

v:\folder1
v:\folder2
v:\folder3
etc.

the goal is to have the folders appear in the destination as:

w:\share\folder1
w:\share\folder2
etc.

problem is, when using robocopy, it is copying the contents of folder1 into w:\share instead of creating folder1 first
i'm doing robocopy v:\folder1 w:\share /e /copy:datsou

i even tried just putting v:\ for the source and for the filename, putting the name of the folder; it ignores the folder and starts copying everything from the root.  i don't want to copy everything from the root level

server is 2008 R2
Avatar of J S
J S
Flag of United States of America image

This was a quick script i tossed together. Test it
Get-ChildItem V:\ | ?{ $_.PSIsContainer } | ForEach-Object { robocopy "V:\$_" "W:\Share\$_." /e /copy:datsou }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of serialband
serialband
Flag of Ukraine image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Seth Simmons

ASKER

If you want it to show up as under share, you must enumerate it.

i was thinking about this this morning; probably just have to create that top level folder first since it doesn't seem possible starting with the folder itself