Skip to content

Instantly share code, notes, and snippets.

@advorak
Created June 13, 2017 03:52
Show Gist options
  • Save advorak/bdc26d2e874cdc17e5d9bfd7e947df73 to your computer and use it in GitHub Desktop.
Save advorak/bdc26d2e874cdc17e5d9bfd7e947df73 to your computer and use it in GitHub Desktop.
require 'fileutils'
floppy_location = '/Volumes/floppy'
files = Dir['/tmp/Mac OS 8.1/*.img.*']
files.each do |file|
puts "#{Time.now}:\t#{file}"
# Wait until floppy is mounted...
until File.exists?(floppy_location) do
sleep 1
end
until File.stat(floppy_location).uid == 501 do
sleep 1
end
# Delete old file off floppy
Dir["#{floppy_location}/*.img.*"].each do |filename|
puts "#{Time.now}"
FileUtils.rm filename
end
file = Dir['/tmp/Mac OS 8.1/*.img.*'].first
filesize = File.stat(file).size
FileUtils.mv file, floppy_location
until !File.exists?(file)
sleep 1
end
until !File.exists?(floppy_location) do
`diskutil eject /dev/disk1`
sleep 1
end
puts "#{Time.now}:\tDISK EJECTED!!!\n\n"
`say "disk ejected"`
end
repeat
with timeout of (60 * 30) seconds
tell application "Finder"
list disks
repeat until (list disks) contains "floppy"
end repeat
set newfiles to files of disk "floppy"
repeat with myfile in newfiles
duplicate myfile to ((((path to desktop folder) as string) & "Downloads:Mac OS 8.5") as alias)
(*((path to desktop folder) & "Downloads:Mac OS 8.5:")*)
if disk "floppy" exists then
eject
end if
end repeat
end tell
end timeout
end repeat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment