I have a single directory with multiple sub-directories and I want to copy all the "*.user" files within the sub-directories into a new main directory. I found the code to that except that I have to both maintain the original file path structure as well as change one of the folder names in it.
Here is an example:
Original File - D:\Projects\APPS\Branch1\Project1\MyFile.user
What I want it to be copied to - D:\Projects\APPS\Branch2\Project1\MyFile.user
The "Project1" path can be a single level or have further sub-directories after it.
Any help on this would be greatly appreciated.
Maintain File Path Structure
Moderator: DosItHelp
Re: Maintain File Path Structure
Code: Select all
xcopy /S "D:\Projects\APPS\Branch1\*.user" "D:\Projects\APPS\Branch2\"
-
- Posts: 3
- Joined: 20 Sep 2010 06:51
Re: Maintain File Path Structure
So the syntax for the destination will maintain everything that comes after Branch1\ up to the *.user file? So if for example one of the *.user files is located in "Branch1\Project\InnerFolder\MyFile.user", the destination syntax will copy the file to -> "Branch2\Project\InnerFolder\MyFile.user"?
Thanks.
Thanks.
Re: Maintain File Path Structure
spoonybard, yes, it copy *.user files with relative path
try, not ask...
see "xcopy /?" for many others options
try, not ask...
see "xcopy /?" for many others options
-
- Posts: 3
- Joined: 20 Sep 2010 06:51
Re: Maintain File Path Structure
Works perfect, thanks. Yeah, got a little too question happy without trying. my bad.
-
- Expert
- Posts: 442
- Joined: 01 Aug 2010 17:13
- Location: Canadian Pacific
- Contact:
Re: Maintain File Path Structure
...Noah Antwiler?