Copy All Subdirectory Contents to New Directory
Apr 6th, 2007 by mark
This entry is merely here so I don’t have to try and remember where I wrote it down for the next time I need it.
Problem
A directory, A, contains many sub-directories, B, C, D, …. Each sub-directory contains one or more files that you want copied to a new directory without the directory hierarchy. Result will be a directory, A1, that contains just files.
Solution
The *nix cp command.
cp -r <source_directory>/*/*.filetype .
Copy, recursively for files (little r, not Directories or big R), from the source_directory, searching all folders (/*), for all files of a type (/*.filetype) to here (.)
Thanks JJ.