Florian Posted February 20, 2013 Share 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 drking and Ramshank 2 Link to comment
CarlosNZ Posted March 31, 2013 Share Posted March 31, 2013 Simple, yet effective! Cheers. Link to comment
stonefury Posted September 10, 2013 Share 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! Link to comment
kopischke Posted October 2, 2013 Share 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 Florian and Southgirl 2 Link to comment
deanishe Posted February 3, 2014 Share 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 Link to comment
rspike12 Posted February 4, 2014 Share 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. Link to comment
deanishe Posted February 4, 2014 Share 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>" Link to comment
rspike12 Posted February 5, 2014 Share Posted February 5, 2014 It doesn't work (in this way I can't see nothing, not even my iMac HD)....any ideas? Link to comment
deanishe Posted February 5, 2014 Share 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? Link to comment
rspike12 Posted February 5, 2014 Share 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. Link to comment
deanishe Posted February 6, 2014 Share 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>" Link to comment
rspike12 Posted February 6, 2014 Share Posted February 6, 2014 yeahhh you're great many thanks Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now