In a bash script I am writing I am having a problem excluding selected directories from tar.
From the machine $SERVER I issue the command
#start netcat on storage server
gnetcat -l -vv -p 2011 >$FILEPATH/$SHORT_NAME.$today.tar &
The the following command is then sent to the $CLIENT.
#start backup sequence
ssh $CLIENT sudo tar cvvf - / --exclude /{db,dev,lost+found,proc} | gnetcat -w 2 -c $SERVER 2011
This has always worked ok and I am able to successfully pipe the output of tar to gnetcat and on to the storage server $SERVER. The directories db, dev, lost+found and proc are excluded from the tar as desired.
A problem shows up when I use find -mtime to try and limit the tar to only files changed in the last n days.
ssh $CLIENT sudo find / -mtime -3 -type -f | ssh $CLIENT sudo tar cvvf - / --exclude /{db,dev,lost+found,proc} |gnetcat -w 2 $SERVER 2011
Tar ignores the --exclude list and recurses through the excluded directories including files found in them. I am trying to update only files changed in the last 3 days and exclude any files in the db, dev, lost+found and proc directories.
I could use some help understanding what I am doing wrong here.