Skip to content

Instantly share code, notes, and snippets.

@AkBKukU
Created December 15, 2021 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AkBKukU/019ee109a36a16a5a553596bcadb8a4e to your computer and use it in GitHub Desktop.
Save AkBKukU/019ee109a36a16a5a553596bcadb8a4e to your computer and use it in GitHub Desktop.
Linux Flopy Disk Extraction Utility
#!/bin/bash
floppy="$1"
# Mount image and extract contents to folder
extract() {
file=$1
echo "Mounting floppy: $file"
sudo mount -o loop $file /tmp/floppy
# Copying into dir
mkdir -p ${file%.*}
rsync -LaPv /tmp/floppy/* ./${file%.*}/
sudo umount /tmp/floppy
}
# Make temp mount for disk images
mkdir -p /tmp/floppy
# Check if single image was specified
if [[ "$floppy" != "" ]] ; then
extract $floppy
exit
fi
# Wrap for non-case sensitive globbing
# Extract all *.img files in folder
(
shopt -s nocaseglob
for file in *.img ; do
extract $file
done
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment