Here’s a simple way to check how much free space is available in destination. Handy for online repositories.
kopia repository status >stat.txt
for /f “tokens=3” %%D in (
‘findstr /rc:“Storage available: [0-9][0-9]*.” “stat.txt”’
) do set free=%%D 2> nul
Now, one can check and use %free% variable in own action (or other) scripts (btw, that strange " 2> nul" expression prevents error massage).
Is this PowerShell? Not familiar enough to be sure.
Anyway I’ve “ported” it to *NIX ; )
kopia repository status | egrep 'Storage (capacity|available)'
No, it is a ordinary windows cmd script. Also, your “port” is missing a variable contain value of free space…? Don’t know much about nix stuff.
I’ve tried to make the percentage of free space (if this is what you have in mind), but I’ve smashed into unit conversions (total space in TB, free in GB). Will update when I’ll find an non-hacky way to do this without too much external tools.
Yeah, I mean something that script can check and decide what to do next. My “action” script uses %free% variable to check if it can safety run a backup, without worrying about free space (particularly, standard google drive service has only 15 GiB of free space).