Search code examples
shelldirectoryfile-copying

On Windows 7, need to copy files from A\ to B\ that are not present in B\


I need to copy files of a certain type (*.vcproj) from a folder tree A\ to the corresponding folder in tree B. There would be several levels of nested folders under A\ and the same folder structure exists within B\, though some folders from A\ may not exist in B\ and vice versa.

I have access to cygwin, perl and powershell. Just not sure how to go about this one.


Solution

  • Robocopy should do what you need. robocopy ./a ./b *.vcproj /s will turn this:

    /a
      /dir
        test.vcproj
      another.vcproj
    
    /b
      /otherDir
    

    Into this:

    /a
      /dir
        test.vcproj
      another.vcproj
    
    /b
      /dir
        test.vcproj
      /otherDir
      another.vcproj