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

[Disk help] Copying files to disk

Started by remiX, 27 October 2012 - 09:18 PM
remiX #1
Posted 27 October 2012 - 11:18 PM
When ever I use the 'copy' program to a floppy disk within a computer terminal, like:

copy file disk/

It copies to the very last folder in the disk folder. How do I change which folder it goes to?
ChunLing #2
Posted 27 October 2012 - 11:24 PM
Are you rewriting copy or looking to use the existing version more effectively?
remiX #3
Posted 27 October 2012 - 11:28 PM
Making a program that just copies content from 1 disk to another. I just can't get the copy part right, everything else is fine :X
tom2018 #4
Posted 27 October 2012 - 11:33 PM
are you basing it off the code i gave you? if you are then look at the loops I made to copy all the programs out of it but not copy the directory itself because you cannot overwrite the disk directory
tom2018 #5
Posted 27 October 2012 - 11:37 PM
tocopy = fs.list("disk")
leng = #tocopy
at = 1
while leng > 0 do
helpful = "disk2/"..tocopy[at]
helpful2 = "disk/"..tocopy[at]
if fs.exists(helpful) then
at = at + 1
else
fs.copy(helpful2,helpful)
leng = leng - 1
at = at + 1
end

are the loops i am talking about
remiX #6
Posted 27 October 2012 - 11:38 PM
are you basing it off the code i gave you? if you are then look at the loops I made to copy all the programs out of it but not copy the directory itself because you cannot overwrite the disk directory

Yeah I saw, I tried copy file disk2/

Says access denied.