#!/usr/bin/env bash # We exclude the various hierarchies via -prune because they are either pseudo-filesystems (EG /dev, /proc), for temporary data only (/tmp, /var/tmp), # for removable media (/media), or for mounting disks temporarily (/mnt). # We use -cmin +0 to select all stat()'able files. Otherwise we get an error on ~/.gvfs, for example. # We have this ROOT variable, so that one can specify where the sshfs is. We have to exclude things by pathname rather than # using -xdev, because sshfs makes all these filesystems look like one filesystem. # To use (example): # ROOT=/mnt/sshfs ubuntu-all-files-over-sshfs | backshift --backup --save-directory /mnt/backshift/save-directory set -eu ROOT="$1" find \ $ROOT \ -path /dev -prune -o \ -path /dev/shm -prune -o \ -path /media -prune -o \ -path /mnt -prune -o \ -path /proc -prune -o \ -path /sys -prune -o \ -path /tmp -prune -o \ -path /var/lock -prune -o \ -path /var/run -prune -o \ -path /var/tmp -prune -o \ -cmin +0 \ -print0