Florian 79 Posted February 20, 2013 Upon Ramshank's request, here's a workflow to check your disk space http://dl.dropbox.com/u/14050630/Disk%20space.alfredworkflow 3 drking, telonaes and Ramshank reacted to this Quote Share this post Link to post
stonefury 5 Posted September 10, 2013 Sweet, thank you. This is perfect. Finding disk space is a but tedious. In my case I have a 500GB SSD drive so I have to keep tabs on it. Thanks again! Quote Share this post Link to post
kopischke 12 Posted October 2, 2013 (edited) I’ve updated Florian’s original workflow. This version has a friendlier display, including correct drive icons handles volumes with spaces in their names displays the correct name of the system drive offers actions on the drives (Finder reveal and Alfred browsing) is certified 100 % awk-free The repo is here, direct download here. Edited October 2, 2013 by kopischke 2 Southgirl and Florian reacted to this Quote Share this post Link to post
deanishe 1,076 Posted February 3, 2014 (edited) Hi guys, Love the proper icons, kopischke, but your workflow shows drives with no free space (e.g. mounted CDs) as 0% full instead of 100% full. Both workflows wrongly add 'b' (instead of 'B'). We're talking about megabytes, not megabits Edited February 3, 2014 by deanishe Quote Share this post Link to post
rspike12 1 Posted February 4, 2014 is it possible to add the view of the network disks? I have a Time Capsule mounted on my desk but I can't see it. Quote Share this post Link to post
deanishe 1,076 Posted February 4, 2014 If you replace the script filter contents with the following, it should do what you want: list=$(df -H) IFS=$'\n' echo '<?xml version="1.0"?><items>' for item in $list do if [[ $item == /* ]]; then #name dev=$(echo $item | awk '{print $1}') path=$(echo $item | awk '{$1=$2=$3=$4=$5=$6=$7=$8=""; print $0}' | sed -e 's/^ *//g' -e 's/ *$//g') name=$path # echo "path : $path, dev : $dev" if [ "$path" == "/" ]; then name="$(diskutil info $dev | sed -nE 's/^ *Volume Name: +([^ ].*) *$/\1/p')" else name="${path##*/}" fi # echo "name : $name" # path=$(echo $item | awk '{print $1}') size=$(echo $item | awk '{print $2}') used=$(echo $item | awk '{print $3}') free=$(echo $item | awk '{print $4}') perc=$(echo $item | awk '{print $5}') free="${free/T/TB}" free="${free/G/GB}" free="${free/M/MB}" free="${free/K/KB}" echo '<item uid="diskspace" arg="" valid="no"> <title>'$name': '$free' available</title> <subtitle>'$used'B ('$perc') used of '$size'B total</subtitle> <icon type="fileicon">'$path'</icon> </item>' fi done echo "</items>" Quote Share this post Link to post
rspike12 1 Posted February 5, 2014 It doesn't work (in this way I can't see nothing, not even my iMac HD)....any ideas? Quote Share this post Link to post
deanishe 1,076 Posted February 5, 2014 I'm afraid I can't help you with no information. Can you copy the script into its own file, run it in Terminal and post the error message you get? Quote Share this post Link to post
rspike12 1 Posted February 5, 2014 If I put your script into the terminal I get the right informations: <item uid="diskspace" arg="" valid="no"> <title><riki12>: 921GB available</title> <subtitle>191GB (18%) used of 1.1TB total</subtitle> <icon type="fileicon">/</icon> </item> <item uid="diskspace" arg="" valid="no"> <title><riki12> TC: 79GB available</title> <subtitle>1.9TB (97%) used of 2.0TB total</subtitle> <icon type="fileicon">/Volumes/<riki12> TC</icon> </item> but if I put your script into Alfred and I digit the keyword "space" nothing happens: I can see the HD icon in a "working" status but nothing more. Quote Share this post Link to post
deanishe 1,076 Posted February 6, 2014 <title><riki12> TC: 79GB available</title> <icon type="fileicon">/Volumes/<riki12> TC</icon> If that's what's coming out of the script, that's what's breaking Alfred. It doesn't like the < and > in the volume name, as it's invalid XML. This might fix the problem: #/bin/bash list=$(df -H) IFS=$'\n' echo '<?xml version="1.0"?><items>' for item in $list do if [[ $item == /* ]]; then #name dev=$(echo $item | awk '{print $1}') path=$(echo $item | awk '{$1=$2=$3=$4=$5=$6=$7=$8=""; print $0}' | sed -e 's/^ *//g' -e 's/ *$//g') name=$path # echo "path : $path, dev : $dev" if [ "$path" == "/" ]; then name="$(diskutil info $dev | sed -nE 's/^ *Volume Name: +([^ ].*) *$/\1/p')" else name="${path##*/}" fi # echo "name : $name" # path=$(echo $item | awk '{print $1}') size=$(echo $item | awk '{print $2}') used=$(echo $item | awk '{print $3}') free=$(echo $item | awk '{print $4}') perc=$(echo $item | awk '{print $5}') free="${free/T/TB}" free="${free/G/GB}" free="${free/M/MB}" free="${free/K/KB}" echo '<item uid="diskspace" arg="" valid="no"> <title><![CDATA['$name': '$free' available]]></title> <subtitle>'$used'B ('$perc') used of '$size'B total</subtitle> <icon type="fileicon"><![CDATA['$path']]></icon> </item>' fi done echo "</items>" Quote Share this post Link to post
rspike12 1 Posted February 6, 2014 yeahhh you're great many thanks Quote Share this post Link to post