Advertisement
Guest User

Floppy image batch mounter/extractor

a guest
Apr 27th, 2010
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.62 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. # Simple Bash script to mount a floppy image and extract its contents.
  4. # Requires a Linux (probably) host with capability of mounting loopback filesystems.
  5. # Useful if you want to archive floppy disks in batches.
  6.  
  7. # if 'mounted' directory doesn't exist, create it
  8. [ ! -d mounted ] && mkdir mounted
  9.  
  10. for image in *.img
  11. do
  12.    echo "--> Starting processing of $image"
  13.    imgname=`basename $image .img`
  14.    echo "--> Image basename is $imgname"
  15.    mkdir $imgname
  16.    mount -t msdos -o loop $image mounted/
  17.    cp -ar mounted/* $imgname
  18.    umount mounted/
  19.    echo "--> Completed processing of $image"
  20. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement