Windows 7 Copy certain files using command prompt recreating folder structure

-null-

Honorable Member
Joined
Feb 5, 2009
At the moment I am using an xcopy command to copy all files with a certain extension to another folder. As the number of files in this folder increases I'd like to organise them into sub folders and have the directory structure mirrored. However I don't want the entire folder contents copied over as there are files not needed in the destination.

My command is currently this
Code:
XCOPY "$(ProjectDir)usercontrols\*.ascx" "..\..\..\Website\usercontrols\" /Y

If I organise my ascx files into sub directories, can xcopy recreate the structure but only copying the .ascx files needed in the destination. Or is there another command line utility that can do so.
 
Did a big more googling and found out about the robocopy utility. The following using that seems to work

Code:
ROBOCOPY "$(ProjectDir)usercontrols" "..\..\..\Website\usercontrols" *.ascx /copy:TD /s /xx /njh /np
 
I was going to suggest robocopy as well before I seen that it was also suggested here. I like the fact that it's also a threading capable utility for multiple operations running asynchronously, but in general it's configurability is a +1 from me. I use it to backup my development projects folder.
 
Back
Top Bottom