1

I have a number of files I need copied to different networked locations. However, it is a regular occurrence that the sub-directories need to be created. I considered building an app to do this, but I'd rather not "re-invent the wheel" if I don't need to.

An example would be as follows:

Copying:

C:\ProjectFolder\Project\WCB\2010\CA\ON\EmployeeReport.aspx.cs

To:

\\Server1\Downloads\Patches\Web\Project\

would end up copying the file to:

\\Server1\Downloads\Patches\Web\Project\WCB\2010\CA\ON\EmployeeReport.aspx.cs

(because "Project" is common in both paths, that's the starting point where we'd need to create the new path.)

Any suggestions?

-- Post Update: Sorry, it seems this is a duplicate of How to copy a file to a directory in DOS, and create directories if necessary?

The answer, although there isn't an automated way of doing this (maybe I'll write that utility after all) is using XCOPY:

XCOPY C:\ProjectFolder\Project\WCB\2010\CA\ON\EmployeeReport.aspx.cs \\Server1\Downloads\Patches\Web\Project\WCB\2010\CA\ON\EmployeeReport.aspx.cs

1 Answers1

1

The answer is to use XCOPY, as suggested in the updated post. XCOPY does a fine job of creating the necessary directory tree on the networked server.