Posted 21 July 2016 - 12:34 AM
I would like to know if you are able to make a program copy itself from a floppy disc to a computer and vise versa.
fs.copy("/absolute/path/to/your/program", "/absolute/path/to/new/location")
--ex
fs.copy("/disk1/mycoolprogram", "/mycoolprogram")
Of course, you probably don't want to hardcode the path to your program, what you can do is call shell.getRunningProgram() like so:
fs.copy(shell.getRunningProgram(), "/mycoolprogram")
Or if you want to preserve the name already given to it you can use fs.getName() which returns the final component of a path (the file's name)
fs.copy(shell.getRunningProgram(), "/" .. fs.getName(shell.getRunningProgram())) --A forward slash is prepended to make sure it gets placed in root, you can change this if you would like