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

Access denied

Started by MewMega, 06 September 2012 - 04:45 PM
MewMega #1
Posted 06 September 2012 - 06:45 PM
I cant use fs.delete and fs.copy, access denied. But ive checked the permissions with fs.isReadOnly and it said false. Heres my Code:


fs.delete("/startup")
fs.copy("/disk/startup", "/")

The other Code is only text, its not needed. But if i run the program like this theres 'Access denied' … Help pls
sjele #2
Posted 06 September 2012 - 06:49 PM
Startup is part of rom (i think) You can't edit startup nor delete it. The file is not realy there. Just make another file called startup and put code to startup from disk there
MewMega #3
Posted 06 September 2012 - 07:42 PM
Thanks for your help i fixed it
kazagistar #4
Posted 06 September 2012 - 07:45 PM
Startup is part of rom (i think) You can't edit startup nor delete it. The file is not realy there. Just make another file called startup and put code to startup from disk there
This has nothing to do with anything. Startup is a normal file like any other, and as can be seen, is clearly not in rom, but in the root directory.

The problem is that in line 2, you are trying to copy startup over the root directory folder. Obviously, this is not allowed. What you want to do is

fs.delete("/startup")
fs.copy("/disk/startup", "/startup")

Here, check out the documentation:
Copies a file or directory to a new location (the parent of the new location must be a directory, toPath must include the target filename and cannot be only a directory to move the file into, and toPath itself must not already exist)
sjele #5
Posted 06 September 2012 - 07:47 PM
Startup is part of rom (i think) You can't edit startup nor delete it. The file is not realy there. Just make another file called startup and put code to startup from disk there
This has nothing to do with anything. Startup is a normal file like any other, and as can be seen, is clearly not in rom, but in the root directory.

The problem is that in line 2, you are trying to copy startup over the root directory folder. Obviously, this is not allowed. What you want to do is

fs.delete("/startup")
fs.copy("/disk/startup", "/startup")

Ohh. Thanks.
MewMega #6
Posted 07 September 2012 - 09:37 AM
Yep i found out

fs.copy("/disk/startup", "/startup")
and it worked. Thanks for your explanation
Hayden_Almeida #7
Posted 07 June 2015 - 01:35 AM
I cant use fs.delete and fs.copy, access denied. But ive checked the permissions with fs.isReadOnly and it said false. Heres my Code:


fs.delete("/startup")
fs.copy("/disk/startup", "/")

The other Code is only text, its not needed. But if i run the program like this theres 'Access denied' … Help pls

I solved this problem!
ACESS DENIED occurs when before in your program or in usage of the computer, you are playing to changing or setting other directories..
Look at this example:

if fs.exists("/contas/"..conta.."/emails/"..assunto) then
When i use this, the WORKING directory is now inside the variable "assunto"!
So when you try to use

fs.delete("/contas/"..conta.."/emails/"..assunto)
It will try to go into more folders in who are already open!

How to Solve? Look:


shell.setDir("/contas/"..conta.."/emails/")
fs.delete("assunto")


Hope this works with you too :D/>