This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
dexter9's profile picture

program that automatically copies file to floppy disk

Started by dexter9, 11 January 2013 - 05:05 AM
dexter9 #1
Posted 11 January 2013 - 06:05 AM
Hi I recently found out about the secret file computercraft has to offer. I decided to make a cinema and to get in you pay with ic2 credits. One computer once the right amount of credits have been given would automatically copy a file to the floppy disk which would open the door to let the customer in. My question is how do i make a program which automatically copies a file when a floppy disk is detected in the disk drive?
Thanks in advance
GravityScore #2
Posted 11 January 2013 - 06:28 AM

while true do
  local e, side = os.pullEvent("disk")
  local mountPath = disk.getMountPath(side)
  fs.copy("/filetocopy", "/" .. mountPath .. "/copiedfile")
end

This question should be in the Ask a Pro section.

Basically, this script keeps checking to see if a disk was inserted into any disk drive next to the computer. If it detects a disk, then it gets the mount path that disk has, then copies a file to it.
dexter9 #3
Posted 11 January 2013 - 06:30 AM
Thanks,sorry im new to forums.