Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.