Find to copy files into single directory

Makes copy of subset of dir/ and below with files that match the criteria. It keeps the nested directory structure. Uses

1
2
3
-print0 | xargs -0
 
to handle spaces in Windows names
-print0 | xargs -0

to handle spaces in Windows names
1
find /cygdrive/f/dir1/ -name '*.doc' -print0 | xargs -0 cp -a --target-directory=/cygdrive/c/Temp --parents
find /cygdrive/f/dir1/ -name '*.doc' -print0 | xargs -0 cp -a --target-directory=/cygdrive/c/Temp --parents

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.