Here is what i have for now:
xcopy "c:\projects\SampleProject" "c:\temp\copytest" /E /H /EXCLUDE:elist.txt
It does all the job i need except filtering filenames by extensions.
For example: copy all *.exe
files from c:\temp\copytest
and subdirectories.
How to do that?
With Xcopy, you can copy files and create the destination directory on the fly. To do so, you need to append the /I option to the Xcopy command. For example, the command below copies the files from the C:\Workarea\Demo folder to the D:\Workarea folder.
To copy a single file or multiple files recursively with the Windows command prompt, use the xcopy command. The xcopy command is very similar to the copy command but it handles recursion and has many other options mainly related to recursion.
By default, xcopy prompts you to specify whether Destination is a file or a directory. Copies directories and subdirectories, unless they are empty. If you omit /s, xcopy works within a single directory. Copies all subdirectories, even if they are empty.
I happened to need this too, and found out that if you want to xcopy files with specific type to a new folder keeping the current folder structure you need only to do this
xcopy [SourcePath]*.mp3 [DestinationPath] /sy
/s: Copies directories and subdirectories, unless they are empty. If you omit /s, xcopy works within a single directory.
/y : Suppresses prompting to confirm that you want to overwrite an existing destination file
Documentation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With