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

Removing A File From Computer

Started by steamruler, 25 February 2012 - 09:25 PM
steamruler #1
Posted 25 February 2012 - 10:25 PM
Due to pranks with the "startup" file, I now got an unusable computer. (Thanks GameDOW…)
He patched CTRL+T.

I got a floppy ready but how can i remove a file on the computer while running from the floppy?
Liraal #2
Posted 25 February 2012 - 10:38 PM
well, the best thing would probably be to insert

a=io.open("startup", "w")
a:write(" ")
a:close()
this into the floppy startup. It will erase the computer's startup.
MysticT #3
Posted 25 February 2012 - 10:48 PM
Or you could use:

fs.delete("startup")
in the floppy startup file.

I think It will work.
steamruler #4
Posted 26 February 2012 - 12:00 AM
Or you could use:

fs.delete("startup")
in the floppy startup file.

I think It will work.

should'nt that be run locally then since the working dirictory is the floppy? That would make the script delete itself. If i could change the workingdirectory to the HDD of the computer it would be all solved.

Ps, please pardon my spelling, its one hour after midnight and im on my iPad.
Xtansia #5
Posted 26 February 2012 - 12:27 AM
Or you could use:

fs.delete("startup")
in the floppy startup file.

I think It will work.

should'nt that be run locally then since the working dirictory is the floppy? That would make the script delete itself. If i could change the workingdirectory to the HDD of the computer it would be all solved.

Ps, please pardon my spelling, its one hour after midnight and im on my iPad.

No in CC all paths are relative to the root directory("/")
Espen #6
Posted 26 February 2012 - 12:54 AM
In your case you could also just manually remove the file from the shell after you've booted from your disk by typing:
rm /startup
Mendax #7
Posted 26 February 2012 - 02:51 AM
Empty startup file on the disk and then type in on the PC: delete startup
steamruler #8
Posted 26 February 2012 - 08:15 AM
I will use fs.delete("startup") then

I want to do it by script since he did it on multiple computers,

Thank you all for your assistance!