From https://www.jackenhack.com/mac-os-purgeable-remove-clear-space/ great advice, I want to make an Applescript app of the shell script command mentioned: [dd if=/dev/zero of=~/stupidfile.crap bs=20m] monitoring the size while it remains under 10gb and stopping the shell script at a predetermined size. I am a low intermediate user of Applescript and Terminal. Jack's instructions work well, but I am trying to automate his work to run regularly and manage four desktops.
tell application "Script Debugger" to activate
tell application "Terminal" to activate
tell application "Finder" to activate
do shell script "touch ~/stupidfile.txt"
do shell script "cd $HOME"
set thePath to "dd if=/dev/zero of=$HOME/stupidfile.txt bs=20m"
--Up to this point, the commands work, but I don't know how to monitor the progress or set limits.
--From here on, I want to do something that monitors the file size (with or w/o the alerts)
do shell script thePath
set theSize to (do shell script "stat -f%z $HOME/stupidfile.txt")
theSizeMB is equal to theSize / (10^3)
display alert "The file is " & theSizeMB & "MB"
repeat while theSize is less than 10^7
theSizeMB is equal to theSize / (10 ^ 3)
display alert "The file is " & theSizeMB & "MB"
end repeat
--The code is incomplete, but could this be modified to work?
I ran this and bloated my HD to <1gb of free space, so it works to create the file.
Thanks,
Mark
tell application "Script Debugger" to activate
tell application "Terminal" to activate
tell application "Finder" to activate
do shell script "touch ~/stupidfile.txt"
do shell script "cd $HOME"
set thePath to "dd if=/dev/zero of=$HOME/stupidfile.txt bs=20m"
--Up to this point, the commands work, but I don't know how to monitor the progress or set limits.
--From here on, I want to do something that monitors the file size (with or w/o the alerts)
do shell script thePath
set theSize to (do shell script "stat -f%z $HOME/stupidfile.txt")
theSizeMB is equal to theSize / (10^3)
display alert "The file is " & theSizeMB & "MB"
repeat while theSize is less than 10^7
theSizeMB is equal to theSize / (10 ^ 3)
display alert "The file is " & theSizeMB & "MB"
end repeat
--The code is incomplete, but could this be modified to work?
I ran this and bloated my HD to <1gb of free space, so it works to create the file.
Thanks,
Mark