0

I'm trying to use tar and xz to make a compressed backup. The command I currently have is:

tar --exclude="/home/derpy/Desktop/WineGames" \
    --exclude="/home/derpy/.steam" \
    --exclude="/home/derpy/Desktop/wesnoth-dev/.git" \
    --exclude="/home/derpy/Desktop/wesnoth-dev/build" \
    --exclude="/home/derpy/Desktop/wesnoth-dev/data" \
    --exclude="." \
    --create \
    --to-stdout \
    --preserve-permissions \
    --ignore-failed-read \
    --directory="/" \
    etc home boot root usr/share | \
xz \
    --lzma2=preset=9e,dict=1536MiB,mf=bt4,mode=normal,nice=273,depth=1000 \
    --to-stdout > \
    "/media/PentaSet/Backups/"(date +"%m-%d-%Y@%I:%M:%S%p")".tar.xz"

However, for some reason when I run the command, the .steam directory is still being included in the output archive.

4

You are doing full path names on the --exclude but relative pathnames in the directories to tar up

eg

--exclude="/home/derpy/.steam"
home

Because you're specifing home the filename tar sees is home/derpy/.steam and not /home/derpy/.steam.

All of your exlcudes should use the filename that would match the name inside the tar file; eg home/derpy/.steam

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.