code
code

Reputation: 5642

How to copy specific file types from one folder into another folder

How do you copy specific file types from one folder into another folder while retaining the folder structure?

The following batch command is capable of copying the specific file types to a folder, but lacks being able to retain the folder structure:

for /R c:\source %%f in (*.cpp,*.h) do copy %%f x:\destination\

How could I modify this to keep the folder structure from the source? Thanks!

Upvotes: 3

Views: 11504

Answers (1)

Magoo
Magoo

Reputation: 79947

xcopy /e c:\source\*.xml x:\destination\

should do the job.

See

xcopy /?

from the prompt for documentation. Use /e for with-empty-directories or /s for to ignore empty directories.

Upvotes: 5

Related Questions