3 posts
Posted 12 July 2012 - 09:51 PM
What I am trying to do is have a program that when my computer turns on it will automatically copy it to the computer from a disk drive and execute it. When i try to do this I cannot seem to copy or execute the code from the drive showing the error of "copy:13:file exists" when i try to just use the copy command. (not the fs.copy command) I am also having issues editing the start up file from the disk. If someone could help that would be great.
504 posts
Location
Seattle, WA
Posted 12 July 2012 - 10:22 PM
Could you please provide some more information?
Perhaps some sample code so we could understand the problem better and help more?
Thanks.
3 posts
Posted 12 July 2012 - 10:51 PM
I was able to copy programs using the "copy" command but i cant seem to copy from the disk to the computer with the fs.copy command. and for editing the start up file on the computer from the disk I have gotten nowhere with so I cannot give more information.
504 posts
Location
Seattle, WA
Posted 12 July 2012 - 11:09 PM
Well, as a bypass for the fs.copy(), assuming the syntax you have been using is correct, try something like this:
file = fs.open("filename", "r");
fileContents = file.readAll();
file.close();
file = fs.opne("filename in new directory", "w");
file.write(fileContents);
file.close();
As for editing the startup file from the disk, the disk will try to edit the startup on the disk by default. Try using the "cd" command to switch to the computer's root directory.
shell.run("cd", "/"); -- This will go to the computer's root directory'.
shell.run("cd" "/startup"); -- This will go to the computer's startup file, as opposed to the disk's startup file.
Hope I helped! :)/>/>
3 posts
Posted 12 July 2012 - 11:59 PM
thanks