• Home
  • About
  • Archives
  • Colophon
  • Resume
  • Tags
  • Tumblr

zanshin.net

because not enough websites start with the letter “Z”

Feed on
Posts
Comments
Tumblr
« Fear Based Living
Der Osterspaziergang »

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.

Posted in nerdliness

Comments are closed.

  • Welcome!

    Mark H. Nichols is an enterprise architect, martial artist, nerd, and all around good guy. Currently he works in Kansas City, and lives in the suburbs with his fiancée, two cats, a couple pianos, and nearly a dozen computers. You can read more about Mark, and this site, or explore the archives.
  • Pages

    • About
    • Archives
    • Colophon
    • Resume
    • Tags
    • Tumblr
  • Popular

    • Shotski's Ring (part I)
    • Shotski's Ring (part II)
    • 10 Mac Apps
    • What is Zanshin?
  • Categories

    • diversions
    • elsewhere
    • family
    • health
    • life
    • links
    • meme
    • nerdliness
    • photography
    • random
    • relationships
    • social issues
    • Uncategorized
  • Archives

    • Blogroll

      • Change.gov
      • Elfenbein Klaviermusik Notes
      • Shawn Blanc
      • Sibylle Kuder
  • Vote

    Obama 08
  • last.fm

    1. cd cover
    2. cd cover
    3. cd cover
    4. cd cover
    5. cd cover
    6. cd cover
  • Meta

    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.org

zanshin.net © 1996 - 2008 All Rights Reserved.

Policies | WordPress Themes | Web Hosting Blue Host