Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

skilledtroll

macrumors newbie
Original poster
Nov 24, 2013
3
0
how do i make a folder that cant be deleted and the contents inside it cant either i just want to make a folder that cant de put in the trash or emptied from the trash and the contents inside the folder cant either and it doesnt have to be a folder it can be a zip too i tried encryption too but that u can just put in to the trash and empty it so yea
 
If you change the directory so that you do not have write access, then you won't be able to delete it or any files inside it. But you won't be able to add files either. It appears that Finder will let you move such a directory to the trash, but you will have to enter your password first.
 
If you change the directory so that you do not have write access, then you won't be able to delete it or any files inside it. But you won't be able to add files either. It appears that Finder will let you move such a directory to the trash, but you will have to enter your password first.
well i need something that makes it completly locked like the systems folder or core services folder
 
The systems folders aren't completely locked; you just need the right permissions.

Any folder created has an owner, and the owner can always change it. The contents are under the same rules.

You can make it difficult to delete a file/folder, but there's always someone owning the directory or the directory above it.

Similar questions get asked like "how can I prevent this file from being copied to an external device?" The answer is you can't - as long as a file can be read it can be copied.

Is this thread a serious question?
 
Is this thread a serious question?

You must have been thrown off by the guy's name and his registration date. I read the post earlier but didn't reply because of that. plus he apparently knew of the core services folder and yet he didnt know that it can in fact be trashed (if he had tried)...
 
how do i make a folder that cant be deleted and the contents inside it cant either i just want to make a folder that cant de put in the trash or emptied from the trash and the contents inside the folder cant either and it doesnt have to be a folder it can be a zip too i tried encryption too but that u can just put in to the trash and empty it so yea

You can lock a file from the get info panel, and you won’t be able to put it in the trash. You’ll be asked for your password before deleting anything in the folder. You have to unlock the folder before you can add anything to it.
 
best approach is create a new partition just for the folder. then set a script that remounts the partition and read only on boot.
 
You must have been thrown off by the guy's name and his registration date.

You haven't exactly been around here all that long either.

His question is 100% legitimate - on Linux what he is asking is achievable with "chattr +i" to set the file or directory as immutable. Once done not even su or root can write the file.

Unfortunately this is not available under OS X.
 
You haven't exactly been around here all that long either.

His question is 100% legitimate - on Linux what he is asking is achievable with "chattr +i" to set the file or directory as immutable. Once done not even su or root can write the file.

Unfortunately this is not available under OS X.

Something similar is:
Code:
sudo chflags schg /path/to/file
See the 'chflags' man page:
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/chflags.1.html

Be sure to read the info at the link to chflags(2) under SEE ALSO, which explains exactly what the flag (SF_IMMUTABLE) does, and how it can be cleared (single-user mode).

The related "uchg" flag is the well-known "Locked" checkbox in the Finder's Get Info window for a file or folder.


Note that if "schg" is set on a folder, then nothing can be added or renamed in that folder. Since the OP didn't say anything about those actions, I took his question to mean that he ONLY wanted to prevent deletion. Also, his later post "completly locked like the systems folder or core services folder" didn't help clarify, because neither of those folders are completely undeletable. And he didn't mention the Linux 'chattr +i' command, so again, not really clear exactly what was wanted.
 
I accidentally delete an important folder once on my desktop. Is there a way to have folder undeletable but allow files to be dropped inside it?
 
I accidentally delete an important folder once on my desktop. Is there a way to have folder undeletable but allow files to be dropped inside it?

You can add an access-control list to the folder to stop you from deleting it. Only root can delete it, be aware of this.
Code:
chmod +a "everyone deny delete" <folder>
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.