At the Linux command line, I'd like to copy a (very large) set of .txt files from one directory (and its subdirectories) to another.
I need the directory structure to stay intact, and I need to ignore files except those ending in .txt.
|
|
You can use find and cpio to do this
|
|||||
|
|
|||||
|
|
Easiest way that worked for me:
one catch is you have to navigate to the "desired" directory before so the "parent path" is correct. Also make sure that you enabled recursive globs in bash:
|
||||
|
|
|
Another approach
|
|||
|
|
|
how about you first copy it over with
then go to the new folder and run
or just
Edit: ok you want one command which filters (I have not tested this because my system doesn't have the
Please test this first, because I haven't tried it yet. If someone would verify, that would be great. |
|||||||||||||
|
|
Navigate to directory:
You'll have to navigate to each folder in the directory, but this is better than most of the options I've seen so far. |
|||||
|