I am wanting to exclude rendered videos (.mp4) from my rsync backups. However there are some .mp4's I need included in the backup. The difference is the path where the MP4's to be excluded are located. What I've tried (unsuccessfully) is:
/home/rpiggott/Videos/youTube/*/*.mp4
- I am trying to use the wild card /*/ is to match all sub-directories. Each video has it's own directory.
- The *.mp4 is an attempt to match the rendered video I want to exclude.
I am adding this to the end of this list.
This is my syntax for the rsync onto my NAS device
sshpass -p PASSWORD rsync -av --del --exclude-from=/var/tmp/ignorelist --numeric-ids /home/rpiggott USER@NAS_IP_ADDRESS:/nfs/rpiggott/
The answer to this is creating a complete exclude with the list of all files you aren't wanting included in your rsync:
Step 1: Create a text file listing the file names (including path) you are excluding from the rsync backup
command \ls /home/rpiggott/Videos/youTube//.mp4 | sed 's:/home/::' > /var/tmp/youTube_mp4_exclude
Step 2: cat the files together
Step 3: Change --exclude-from to the new file created:
If you are setting this up as a cron use a .sh file with file file permission 755