Posted By

tylerhall on 05/04/07


mac unix osx mount awk umount

Versions (?)

Who likes this?

3 people have marked this snippet as a favorite


Unmount All AFP Network Shares

 / Published in: Bash

This command will force all mounted AFP network drive to disconnect. I've set this to run automatically each time my laptop sleeps so that if I wake it up on a different network Finder won't freak out.

  1. mount | awk '/^afp_/ { system("umount -f " $3) }'

Report this snippet  


RSS Icon Subscribe to comments
Posted By: the_coder on November 25, 2009

Note this does not work if the mounted network drive contains a space, eg "/Volumes/Some Stuff/", as drive name will then be split over 2 columns. I cannot provide a solution in awk as I don't know it well enough, but I may write a perl script to parse drive info instead.

You need to login to post a comment.