1

I am developing an Android-app in OS X, and want to use some third-party icons. I have downloaded and extracted the icons into this folder structure:

  • drawable-mdpi
    • ic_icon1.png
    • ...
  • drawable-hdpi
    • ic_icon1.png
    • ...
  • drawable-xhdpi
    • ic_icon1.png
    • ...
  • drawable-xxhdpi
    • ic_icon1.png
    • ...

I want to copy the files named ic_icon1.png from each directory into my own folder structure with the same folders, ignoring the rest of the icons in the source folders. How can I accomplish this using Finder or Terminal?

2

You can use gcp from homebrew for this. Install gcp with

brew install coreutils

Then You can make something like this:

gcp --parents drawable*/ic_icon1.png /path/to/output/dir

This will copy all ic_icon1.png preserving directory tree.

From man gcp:

   --parents
          use full source file name under DIRECTORY
  • Is it possible to copy all files from each folder into a single destination folder? – Keyslinger Aug 18 '18 at 18:34
  • 1
    @Keyslinger maybe something like find . -type f -exec cp {} /path/to/dest/dir/ \; – Mateusz Szlosek Aug 18 '18 at 18:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .