You could run something
du from a cron job. With GNU tools,
du -sb dir/ would give you the size in bytes of the directory and all files within it, recursively (plus the directory name, but we can remove that). And you can get the date with
$ printf "$(date +"%F %T") $(du -sb /tmp)\n"
2018-07-03 15:25:57 24246930 /tmp
Then put that in a cron job and direct the output to a file. A crontab entry to run at 06:00 every day could be something like this (of course, I'm only using
/tmp here as just an example):
0 6 * * * printf "$(date +"\%F \%T") $(du -sb /tmp)\n" >> /tmp/tmp-size.log
The percent signs need to be escaped for
You could use
du -sk for kilobytes, or
du -sh for "human-readable" auto-scaling output. The options accepted by
du may be different on another system.
Use something like
du ... | sed -e 's/[[:blank:]].*//' instead, if you want to remove the pathname that