(If you want to just straight to managing 3.5 floppy disk drives with Mac OS X, skip to the “Setting up your terminal for managing floppy disks from command line” section below, otherwise enjoy reading 🙂
I always thought these days were past me. That I would never need face this creature again. It was a dark fragment of my past filled with pain and corrupted University assignments discovered the day before they were due …
However as the saying goes “Your shady past always catches up with you …”. And today was the day it did!
It was triggered somewhat by the unceremoniously named Cleanup Day. For those outside of Australia, it’s the day of the year when you:
- Go hunting for all the crap you’ve accumulated over the last few generations
- Evaluate whether to throw it or not
- 99% of the time, decide no (The cleanup dudes need jobs right!)
- Leave it for someone more sensible in the family to do it instead
In this instance however, both the person ‘evaluating’ and ‘sensible one’ happen to be me. (contrary to every other instance perhaps). During the bulldozing operation, I stumbled upon crates containing the now defunct 3.5 inch floppy drives. Least to say, it triggered a flood of emotions; anger, frustration, hunger (was close to lunch time), nostalgia.
Hauling the crates across to my room, I sat one one of them deciding what to do. I needed to check them for personal stuff naturally before throwing them out.
A couple of years ago (around 2003), I had bought my first laptop (Thinkpad T41 – when they used to make them like bricks!). For some reason I also ended up getting a USB 3.5 inch floppy disk drive (Sony MPF82E-U1). That was around the time when USB MP3 players (iPod was an unknown back then) were becoming mainstream.
Anyway, fast forward to Aug 2012, I had a heap of floppy disks sitting around waiting to be thrown out. The only PC I had at my disposal was my Macbook Pro 15 (Late 2008) + 8 Gb RAM + Mountain Lion ….. and my 3.5 inch floppy disk drive
I was essentially at this point (after plugging in the USB floppy drive)
- Inserting the disk
- Twiddling fingers until it mounted
- Using Finder to drag and drop
- Formatting the disk using Disk Utility
- Ejecting the disk
Setting up your terminal for managing floppy disks from command line
As you can realise this gets boring
very quickly. So I fired up
iTerm2.
Making sure I was in the home folder
cd $HOME
Edit your .bash_profile
vim .bash_profile
Now paste the lines below (Feel free to modify them if you like)
alias reload_bashrc=". $HOME/.bash_profile"
alias lsfloppy="sleep 1s; reload_bashrc; ls \"`mount | perl -n -e 'if ($subject = m/.*(\/dev\/disk\d+)\son\s(.*)\s.*msdos.*/i) { print "$2" }'`\""
alias cpfloppy="reload_bashrc; cp -pvR "\"`mount | perl -n -e 'if ($subject = m/.*(\/dev\/disk\d+)\son\s(.*)\s.*msdos.*/i) { print "$2" }'`\""/* $@"
alias floppy_format="sudo diskutil eraseVolume "MS-DOS" UNTITLED "\"`mount | perl -n -e 'if ($subject = m/.*(\/dev\/disk\d+)\son\s(.*)\s.*msdos.*/i) { print "$1" }'`\"""
alias floppy_eject="sudo diskutil eject "\"`mount | perl -n -e 'if ($subject = m/.*(\/dev\/disk\d+)\son\s(.*)\s.*msdos.*/i) { print "$1" }'`\"""
alias floppy_format_eject="floppy_format; floppy_eject"
You can either close and re-open iTerm2 OR run . ~/.bash_profile (to load the alias directives into your current shell session)
The commands are generally pretty self explanatory, but what they let you do is
lsfloppy – List contents of the floppy disk
cpfloppy <destination> – Copy contents of the floppy disk to <destination>
floppy_format – Formats the floppy disk
floppy_eject – Ejects the floppy disk
floppy_format_eject – Formats and ejects the floppy disk
Basically, these commands saved me hours. I’m sure there’s other ways of making those alias commands even more compact (I’m no shell script guru) but I found this worked best for me. Feel free to post any other tips you might have. (Although I can’t imagine too many floppy disk users out there anymore!)