This is what I use to make a backup copy of all my images to a temporary folder in Linux. It excludes a number of file extensions, like the ones for movies. It is executed from the folder that contains the files you want to copy.
sudo tar cvf - * --exclude *.MTS --exclude *.mpg --exclude *.MPG --exclude *.mp4 --exclude *.modd --exclude *.db --exclude *.avi --exclude *.AVI --exclude *.THM --exclude *.idx --exclude *.info --exclude *.mov --exclude *.MOV --exclude *.zip --exclude *.dat --exclude *.db --exclude adirectory/* | ( cd /media/spruit/ausbstick; tar xfp -)
Tags: copy files, exclude, Linux, tar, ubuntu
Hmmm, the exclude for a directory does not seem to work. Solved it for now by deleting the directory manually from the usb stick once it was copied.
Solved this by using this command. Excludes work again:
tar cvpfz /home/spruit/backup_laptop_arie_U1610studio.tgz \
–exclude=/home/spruit/.cache \
–exclude=/var/cache \
–exclude=/var/crash \
–exclude=/var/lib \
–exclude=/var/spool \
–exclude=/var/tmp \
–exclude=/home/spruit/.gvfs \
–exclude=/home/spruit/.local/share/Trash \
–exclude=/home/spruit/Afbeeldingen \
–exclude=”/home/spruit/Backup oude laptop” \
–exclude=/home/spruit/Downloads \
–exclude=/home/spruit/Pictures \
–exclude=/home/spruit/Synology \
–exclude=/home/spruit/Videos \
–exclude=/home/spruit/backup_laptop_arie_U1610studio.tgz \
–exclude=/media \
–exclude=/proc \
–exclude=/lost+found \
–exclude=/mnt \
–exclude=/sys \
/etc \
/home \
/usr/local \
/var