--Last updated on pastebin: 3/15/14

--Simple disk reader utility by austinv11

print ( "Checking for drives..." )

while true do

local checkT = disk . isPresent ( "top" )

local checkB = disk . isPresent ( "bottom" )

local checkL = disk . isPresent ( "left" )

local checkR = disk . isPresent ( "right" )

local checkBA = disk . isPresent ( "back" )

local checkF = disk . isPresent ( "front" )

if checkT == true then

print ( "Disk drive found on top" )

print ( "Looking for disks..." )

while true do

local check = disk . hasData ( "top" )

if check == true then

local path = disk . getMountPath ( "top" )

local name = disk . getLabel ( "top" )

if name == nil then

name = disk . getID ( "top" )

end

print ( "Disk " .. name .. " found! Copying and running..." )

fs . copy ( path , "/" .. name )

shell . run ( name )

break

else

sleep ( 5 )

end

end

break

elseif checkB == true then

print ( "Disk drive found on bottom" )

print ( "Looking for disks..." )

while true do

local check = disk . hasData ( "bottom" )

if check == true then

local path = disk . getMountPath ( "bottom" )

local name = disk . getLabel ( "bottom" )

if name == nil then

name = disk . getID ( "bottom" )

end

print ( "Disk " .. name .. " found! Copying and running..." )

fs . copy ( path , "/" .. name )

shell . run ( name )

break

else

sleep ( 5 )

end

end

break

elseif checkL == true then

print ( "Disk drive found on left" )

print ( "Looking for disks..." )

while true do

local check = disk . hasData ( "left" )

if check == true then

local path = disk . getMountPath ( "left" )

local name = disk . getLabel ( "left" )

if name == nil then

name = disk . getID ( "left" )

end

print ( "Disk " .. name .. " found! Copying and running..." )

fs . copy ( path , "/" .. name )

shell . run ( name )

break

else

sleep ( 5 )

end

end

break

elseif checkR == true then

print ( "Disk drive found on right" )

print ( "Looking for disks..." )

while true do

local check = disk . hasData ( "right" )

if check == true then

local path = disk . getMountPath ( "right" )

local name = disk . getLabel ( "right" )

if name == nil then

name = disk . getID ( "right" )

end

print ( "Disk " .. name .. " found! Copying and running..." )

fs . copy ( path , "/" .. name )

shell . run ( name )

break

else

sleep ( 5 )

end

end

break

elseif checkBA == true then

print ( "Disk drive found on back" )

print ( "Looking for disks..." )

while true do

local check = disk . hasData ( "back" )

if check == true then

local path = disk . getMountPath ( "back" )

local name = disk . getLabel ( "back" )

if name == nil then

name = disk . getID ( "back" )

end

print ( "Disk " .. name .. " found! Copying and running..." )

fs . copy ( path , "/" .. name )

shell . run ( name )

break

else

sleep ( 5 )

end

end

break

elseif checkF == true then

print ( "Disk drive found on front" )

print ( "Looking for disks..." )

while true do

local check = disk . hasData ( "front" )

if check == true then

local path = disk . getMountPath ( "front" )

local name = disk . getLabel ( "front" )

if name == nil then

name = disk . getID ( "front" )

end

print ( "Disk " .. name .. " found! Copying and running..." )

fs . copy ( path , "/" .. name )

shell . run ( name )

break

else

sleep ( 5 )

end

end

break

else

sleep ( 5 )

end