Created
December 15, 2021 14:13
-
-
Save AkBKukU/019ee109a36a16a5a553596bcadb8a4e to your computer and use it in GitHub Desktop.
Linux Flopy Disk Extraction Utility
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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