I am trying to script checking a network volume and comparing it against with a local copy to see if there is enough space to copy the files.
The files will copied using rsync and I use the following to get the available space
VAR1=`du -sh /Volumes/networkshare/user`
VAR2=`du -sh /Users/user1/`
If I was to do an
if [ $VAR1 -lt $VAR2 ]
then echo "Enough Space"
fi
Then that might work for the initial backup but this will run once a day using rsync and therefore wont be a good check for available space as only new files and changed files will be copied up. Is there a better way to do this sort of check?
Edit: The share has a size limit of 50gb but I am unsure how I could use this if rsync isnt copying everything
Thanks
Try doing this:
If you want to sum the needed size for the case 2 (incremental), consider the Etan Reisner's proposition bellow your post.