Did you know you can use Swift as code in the Mac Shortcuts app? You can do other languages as well: Perl, Python and Ruby. AppleScript and JavaScript too, of course. Here's an example of using a bit of Swift in a Shortcut to sort lines of text. And here's the Shortcut if you want it. <a href="https://www.icloud.com/shortcuts/8ef27a8d83334ece808e699ce086de67" rel="nofollow noopener" target="_blank">https://www.icloud.com/shortcuts/8ef27a8d83334ece808e699ce086de67</a>
I was thinking that I could take today's video about 20 places to look to clean up your Mac and turn it into a Shortcut. Then you can just run that Shortcut and it will tell you how much space is being used by these things. Here is where I'm at so far, with three of those items in the Shortcut. Here's some of that code. You can use it in the Terminal as well as in Shortcuts. I'm hoping this works out and I can turn this into a tutorial and share the final Shortcut. du -sh '~/Movies/TV/Media.localized/Home Videos' | cut -f1 du -sch '~/Movies/TV/Media.localized/Movies' '~/Movies/TV/Media.localized/Downloads-TV' | tail -n1 | cut -f1 du -sch '/Library/Application Support/GarageBand' '/Library/Application Support/Logic' '/Library/Audio/Apple Loops' '/Library/Audio/Apple Loops Index' | tail -n1 | cut -f1