DrDavid
DrDavid

Reputation: 964

Find all files, and copy them to a folder (Flatten recursively)

Basically, I have a very large filesystem that contains media. It has a ton of silly subfolders. I'd like to find all the files (any file) and copy them flatly into a directory. What's the best/easiest way to do this?

Assume that the directory of media is located at /home/user/media and the location of the destination directory is /home/user/flatmedia

I'd like to do this using standard mac tools.

Upvotes: 16

Views: 11338

Answers (1)

Ganesh Sittampalam
Ganesh Sittampalam

Reputation: 29100

find /home/user/media -type f -exec cp {} /home/user/flatmedia \;

Note - if there are any duplicates there's no particular guarantee about which one you'll get.

Upvotes: 32

Related Questions