Posts mit dem Label copy werden angezeigt. Alle Posts anzeigen
Posts mit dem Label copy werden angezeigt. Alle Posts anzeigen

Mittwoch, 7. Dezember 2011

Copy files recursively without keeping directory structure (Linux)

We had to copy many files that were located in a very complex directory structure. The following snippet searches the current directory and its subdirectories for *.xml files & executes the cp command on every file it finds (the braces {} represent the file):

find -type f -iname '*.xml' -exec cp {} /target/dir/for/all/xmls/ \;

The target dir now contains all *.xml files without directories.