Exclusion file / ignore proposal for backup

Hi there, I am looking on some feedback to get a file to use as input for --exclude-file backup option for Linux (Ubuntu in this case).

I am not sure if it is required to scape spaces (\ ) in directories or file names (e.g. $HOME/.config/chromium/Default/Application Cache)

Here is what I have for the moment for the .resticexclude file. Comments are welcome:

$HOME/Downloads/*
$HOME/Pictures/*
$HOME/Dropbox/*

# Maven target
target/*

$HOME/.Private
$HOME/.cache
$HOME/.gvfs
$HOME/.local/share/gvfs-metadata
$HOME/.dbus
$HOME/.Trash
$HOME/.local/share/Trash
$HOME/.cddb
$HOME/.aptitude
$HOME/.bash_history

###############################################
# Directories, probably not worth a backup    #
# (uncomment the files you don't need)        #
###############################################

#$HOME/.android
#$HOME/.AndroidStudio*/
#$HOME/Android/Sdk
#$HOME/.gradle
#$HOME/.gvm
#$HOME/.grails/
#$HOME/.grails_history
#$HOME/.kde/share/apps/nepomuk
#$HOME/.local/share/notbit
#$HOME/.local/libvirt
#$HOME/.vagrant
#$HOME/.vagrant.d
#$HOME/.wine
#$HOME/.twister
#$HOME/twister
#*Popcorntime*
#/Scribus
#/VirtualBox*
#
## Add Game Folders here:
#
#/games
#$HOME/.local/share/Steam
#$HOME/.steam
#Steam
#$HOME/.minecraft
#$HOME/.PlayOnLinux

# Adobe and Flash
$HOME/.adobe
$HOME/.macromedia

# Files
$HOME/.xsession-errors
$HOME/.recently-used
$HOME/.recently-used.xbel
$HOME/.thumbnails
$HOME/.Xauthority
$HOME/.ICEauthority
$HOME/.gksu.lock
$HOME/.pulse
$HOME/.pulse-cookie
$HOME/.esd_auth

# Local repositories (added by errantlinguist on 2015-04-13):
$HOME/.gradle/caches
$HOME/.m2/repository

# Node Package Manager cache
$HOME/.npm

# Thunderbird Cache in your profile folder
$HOME/.thunderbird/*/Cache

# KDE specific
$HOME/.kde/share/apps/RecentDocuments
$HOME/.kde/share/apps/klipper
$HOME/.kde/share/apps/okular/docdata
$HOME/.kde/share/apps/gwenview/recentfolders
$HOME/.kde/share/apps/kmess/displaypics
$HOME/.kde/share/apps/kmess/customemoticons

# Firefox
$HOME/.mozilla/firefox/*/Cache
# in case Fx crashes dumps will be stored in this
$HOME/.mozilla/firefox/*/minidumps
# session-specific
$HOME/.mozilla/firefox/*/.parentlock
# phishing database, recreated
$HOME/.mozilla/firefox/*/urlclassifier3.sqlite
# blacklisted extensions
$HOME/.mozilla/firefox/*/blocklist.xml
# extension database, recreated on startup
$HOME/.mozilla/firefox/*/extensions.sqlite
$HOME/.mozilla/firefox/*/extensions.sqlite-journal
$HOME/.mozilla/firefox/*/extensions.rdf
$HOME/.mozilla/firefox/*/extensions.ini
$HOME/.mozilla/firefox/*/extensions.cache
# cached UI data, recreated
$HOME/.mozilla/firefox/*/XUL.mfasl
$HOME/.mozilla/firefox/*/XPC.mfasl
$HOME/.mozilla/firefox/*/xpti.dat
$HOME/.mozilla/firefox/*/compreg.dat
# cached plugin data, recreated
$HOME/.mozilla/firefox/*/pluginreg.dat


# Opera
$HOME/.opera/temporary_downloads
$HOME/.opera/cache
$HOME/.opera/thumbnails
$HOME/.opera/opcache
$HOME/.opera/icons
$HOME/.opera/application_cache
$HOME/.opera/widgets/*/cache
$HOME/.opera/lock

# GnuPG
$HOME/.gnupg/rnd
$HOME/.gnupg/random_seed
$HOME/.gnupg/.#*
$HOME/.gnupg/*.lock
$HOME/.gnupg/gpg-agent-info-*

# Chromium
$HOME/.config/chromium/Default/Local Storage
$HOME/.config/chromium/Default/Session Storage
$HOME/.config/chromium/Default/Application Cache
$HOME/.config/chromium/Default/Archived History
$HOME/.config/chromium/Default/History
$HOME/.config/chromium/Default/Favicons

# Indexer
$HOME/.local/share/baloo
$HOME/.local/share/zeitgeist
$HOME/.local/share/akonadi

# Misc
# pidgin
$HOME/.pulse/icons
$HOME/.java/deployment/cache
$HOME/.icedteaplugin
$HOME/.icedtea
$HOME/.gnome2/epiphany/favicon_cache
# to avoid problems, let Dropbox re-create these
$HOME/.dropbox
$HOME/.dropbox-dist

If you have so many files to exclude why not just try it from another perspective: create a file that includes everything you want to back up and not what you don’t want to backup using the --files-from argument.

I think this approach does not fit what I want. New files and directories can be created in my home and I wouldn’t like to be constantly checking and updating the files to include. I would prefer to exclude unnecessary files and caches from applications and keep all the rest (configurations and personal data).

Does anyone know if scaping spaces as I menction in the post is required? Thanks :slight_smile:

It’s not necessary, but won’t hurt either. I prefer writing exclude files without quoting spaces, that’s much easier to read.

1 Like

(I cannot edit the original message so I post again)

A little more updated file for excludes:

$HOME/NoBackup/*
$HOME/Downloads/*
$HOME/Pictures/*
$HOME/Dropbox/*

$HOME/.ecryptfs
$HOME/.Private
$HOME/.cache
$HOME/.gvfs
$HOME/.local/share/gvfs-metadata
$HOME/.dbus
$HOME/.Trash
$HOME/.local/share/Trash
$HOME/.cddb
$HOME/.aptitude
$HOME/.bash_history

###############################################
# Directories, probably not worth a backup    #
# (uncomment the files you don't need)        #
###############################################

$HOME/.android
$HOME/.IntelliJIdea*
$HOME/.AndroidStudio*
$HOME/Android/Sdk
$HOME/.gradle
#$HOME/.gvm
#$HOME/.grails/
#$HOME/.grails_history
#$HOME/.kde/share/apps/nepomuk
#$HOME/.local/share/notbit
#$HOME/.local/libvirt
#$HOME/.vagrant
#$HOME/.vagrant.d
$HOME/.wine
#$HOME/.twister
#$HOME/twister
#*Popcorntime*
#/Scribus
#/VirtualBox*
#
## Add Game Folders here:
#
#/games
#$HOME/.local/share/Steam
#$HOME/.steam
#Steam
#$HOME/.minecraft
#$HOME/.PlayOnLinux

# Adobe and Flash
$HOME/.adobe
$HOME/.macromedia

# Files
$HOME/.xsession-errors
$HOME/.recently-used
$HOME/.recently-used.xbel
$HOME/.thumbnails
$HOME/.Xauthority
$HOME/.ICEauthority
$HOME/.gksu.lock
$HOME/.pulse
$HOME/.pulse-cookie
$HOME/.esd_auth

# Thunderbird Cache in your profile folder
$HOME/.thunderbird
$HOME/.thunderbird/*/Cache

# KDE specific
$HOME/.kde/share/apps/RecentDocuments
$HOME/.kde/share/apps/klipper
$HOME/.kde/share/apps/okular/docdata
$HOME/.kde/share/apps/gwenview/recentfolders
$HOME/.kde/share/apps/kmess/displaypics
$HOME/.kde/share/apps/kmess/customemoticons

# Firefox
$HOME/.mozilla/firefox/*/storage
$HOME/.mozilla/firefox/*/Cache
# in case Fx crashes dumps will be stored in this
$HOME/.mozilla/firefox/*/minidumps
# session-specific
$HOME/.mozilla/firefox/*/.parentlock
# phishing database, recreated
$HOME/.mozilla/firefox/*/urlclassifier3.sqlite
# blacklisted extensions
$HOME/.mozilla/firefox/*/blocklist.xml
# extension database, recreated on startup
$HOME/.mozilla/firefox/*/extensions.sqlite
$HOME/.mozilla/firefox/*/extensions.sqlite-journal
$HOME/.mozilla/firefox/*/extensions.rdf
$HOME/.mozilla/firefox/*/extensions.ini
$HOME/.mozilla/firefox/*/extensions.cache
# cached UI data, recreated
$HOME/.mozilla/firefox/*/XUL.mfasl
$HOME/.mozilla/firefox/*/XPC.mfasl
$HOME/.mozilla/firefox/*/xpti.dat
$HOME/.mozilla/firefox/*/compreg.dat
# cached plugin data, recreated
$HOME/.mozilla/firefox/*/pluginreg.dat

# Opera
$HOME/.opera/temporary_downloads
$HOME/.opera/cache
$HOME/.opera/thumbnails
$HOME/.opera/opcache
$HOME/.opera/icons
$HOME/.opera/application_cache
$HOME/.opera/widgets/*/cache
$HOME/.opera/lock

# GnuPG
$HOME/.gnupg/rnd
$HOME/.gnupg/random_seed
$HOME/.gnupg/.#*
$HOME/.gnupg/*.lock
$HOME/.gnupg/gpg-agent-info-*

# Chromium
$HOME/.config/chromium/Default/Local Storage
$HOME/.config/chromium/Default/Session Storage
$HOME/.config/chromium/Default/Application Cache
$HOME/.config/chromium/Default/Archived History
$HOME/.config/chromium/Default/History
$HOME/.config/chromium/Default/Favicons

# Electron apps seem to do this
$HOME/.config/**/Cache
$HOME/.config/**/GPUCache
$HOME/.config/**/ShaderCache
$HOME/snap/**/.config/**/Cache
$HOME/snap/**/.config/**/GPUCache
$HOME/snap/**/.config/**/ShaderCache

# Indexer
$HOME/.local/share/baloo
$HOME/.local/share/zeitgeist
$HOME/.local/share/akonadi

# Misc
# pidgin
$HOME/.pulse/icons
$HOME/.java/deployment/cache
$HOME/.icedteaplugin
$HOME/.icedtea
$HOME/.gnome2/epiphany/favicon_cache
# to avoid problems, let Dropbox re-create these
$HOME/.dropbox
$HOME/.dropbox-dist
# Ivy2
$HOME/.ivy2

###########################
#  PROGRAMMING LANGUAGES  #
###########################

# Local repositories (added by errantlinguist on 2015-04-13):
$HOME/.m2/repository

# Maven target
target/*

# Scala stuff
# Coursier cache (Scala fetch libraries)
$HOME/.coursier/cache
$HOME/.sbt

# Haskell
$HOME/.stack

# Node Package Manager cache
$HOME/.npm

# Eclipse
$HOME/.eclipse
$HOME/workspace/.metadata

# Python virtual env
$HOME/.venv-py3

# ------------------------