So what I think you are attempting here is to set disk to the disk path, and you want to make it so you can type a name to copy from the name, to the disk. If so, this is a very simple problem to solve! You almost got it just a few errors! Lets fix this
name = io.read()
Pretty sure that works, but just for notes, you can also use
name = read()
and do the same
disk = fs.isDir("disk")
what you got here is a variable called disk and you are setting it to fs.isDir("disk"). If you look at the isDir() function you can see that it return a boolean. So basically you are saying disk is equal to true if disk is a dir, and false if it is not. A easier way of doing this is just saying
if (fs.exists("disk")) then
-- fs.copy code
end
fs.copy("name, disk")
a bit wrong but like I said, we all have made mistakes
you are calling the function fs.copy() and telling it to copy "name,disk" to blank
What you really need to be doing is telling it to copy the name to the disk. You can do so very easy like so
fs.copy(name,"disk/"..fs.getName(name))
Basically this would do so: If name is "test/file" then it copies file to disk/file! Nice! Lets see this all wrapped up!
term.clear()
term.setCursorPos(1,1)
term.write("What's the porgram you want to copy?")
local name = read()
if (fs.exists("disk")) then
fs.copy(name,"disk/"..fs.getName(name))
else
term.write("Sorry, you seem to not have a disk in the drive! Place it in and try again.")
end
Everything looks good above. Test that and tell me if it works. If not, we can see what was done wrong
I hope this helped!