bash - Calculate foldersize exlude files hardlink -


i'm using bash script rsync create daily , weekly backups. how works in short:

  • the script sets variables days , weeks.
  • current day folder gets emptied: rm -rf /path/to/$currentday/*
  • previous day content gets copied current day (hardlinks): cp -ral /path/to/$previousday/* /path/to/$currentday/
  • the script syncs changes made: rsync -tru --progress /path/to/source/* /path/to/$currentday/

this being pulled 1 storage device on wan. since company growing need monitor how data being sent on wan every time script runs.

is there way me calculate $currentday folder , exclude files didn't change (still hardlinked)?

or maybe add line script log files being sent?

i've been searching internet unfortunately didn't find useful, try comes total size of folder, 2tb.

did willing share me?

i observed du has hability count size of hardlinks once. test steps:

mkdir 1 2 cd 1 dd if=/dev/zero of=f1 bs=1024 count=1024 dd if=/dev/zero of=f2 bs=1024 count=2048 cd ../2 ln ../1/f1 cp ../1/f2 . cd .. du -shc 1 2 du -shc 2 1 

you see second folder doesn't take account size of hardlinks used. perhaps approach of help.


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -