An IBM Spectrum Protect / HFS Backup / TSM client size limiting script

In my university we have hte ability to use IBM Spectrum Protect aka HFS Backup aka Tivoli Storage Manager for backing up large amounts of experimental data. Unfortunately, due to local rules this fails if the amount of data to be sent is more than 200 GiB and we have to email the central team and ask them to let us back it up again. The below script (just about) automatically stops the process if it’s going to bust a pre-determined size limit. It might fail if large (usually >1 TiB) files are examined but not transferred. Tested on linux and MacOS.

Woo.