nav-left cat-right
cat-right
Matthias Pospiech > Linux > bash: Copy everthing except …

bash: Copy everthing except …

If you want to copy multiple files, keep the permission, and want to exclude multiple files from being copied this can be done with the following code:

tar cp --exclude-from=$EXCLUDE $FROMDIR | (cd $DESTDIR ; tar xpv)

$EXCLUDE contains the file that contains the folders and files that shall be exluded. It can be created and filled with

EXCLUDE="exclude.txt"
touch $EXCLUDE
echo "$HOME/.kde" >> $EXCLUDE
echo "$HOME/.texmf" >> $EXCLUDE
echo "$HOME/.cxoffice" >> $EXCLUDE

Other solutions for this problem are possible as well. Especially rsync should be a good candidate.

Einen Kommentar schreiben

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.

*

This blog is kept spam free by WP-SpamFree.