This is how I have successfully implemented it. I am using HA docker installed in Raspbian OS. I also use the auto snapshot backup addon with HA. First I have used the crontab -e command in terminal to schedule a command maybe 30 minutes after the time set for initiating auto backup. The command is 30 4 * * * sudo du -h -s /usr/share/hassio/backup |cut -d'M' -f1 | sudo tee /usr/share/hassio/homeassistant/www/node_red/size.text . In my case the above command is scheduled to run at 4.30am every day as I have set the time for auto backup at 4am. Please mind this time difference is very crucial.
This command will write the size of the snapshot created to a file with the name size.text in www folder of HA, after the backup has been initiated. Then you can use a file sensor in HA to read the contents of the file which is the size of the snapshot.
Due to the limitations of the folder sensor (not able to access /backup as HA container when running HA OS), I went the MQTT path instead of using a file as temporary information cache. Works the same. Following InfluxDB information (database size) as sensor in Home Assistant - #17 by e-raser where InfluxDB folder size is gathered - same process.
The clue is to get the information at all, for this I used the community SSH & Web Terminal with protection mode off and using this within the init_commands in the addons configuration section:
while [ 1 = 1 ]; do du -shm /backup | cut -f1 | mosquitto_pub -t homeassistant/sensor/system/foldersize/backup -r -u '<mqtt_username>' -P '<mqtt_password>' -l -i 'SSH-addon_init-command_1' && sleep 900; done &
So every 15 minutes (sleep 900) the size is calculated and sent to the MQTT broker.
Then the following MQTT sensor creates the sensor entity: