4
votes
2answers
4k views

How to copy only matching files, preserving subdirectories

Is there a way to do this: "How can I copy a subset of files from a directory while preserving the folder structure?", but without using rsync? Is it possible to be done using only cp, find and grep? ...
7
votes
2answers
2k views

How can you move (or copy) all files to a directory with the same filename prefix?

Using Bash So let's say I have a bunch of files randomly placed in a parent directory ~/src, I want to grab all the files matching a certain suffix and move (or copy) them to a ~/dist directory. ...
5
votes
2answers
582 views

How can I copy a subset of files from a directory while preserving the folder structure?

I want to move some subset of files from dirA to dirB (let's say files with "blah" in the filename), but I want all the nested directories to be the same in the new location. How can I do that?