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

Kyle Nerder

macrumors regular
Original poster
Oct 14, 2005
189
0
Toronto
Hey,

This might be considered an odd question, but I was wondering if there was a way to make a file modifiable, but not deletable.

At our office there is a excel file we all need to access to read and modify, but I am afriad someone relocating or placing it in the trash...

Any words of advice?
 
Mmm...that's a toughie. I don't know any easy way to do that. As far as I know, with Unix file permissions, write permissions are an all/nothing proposition -- you can either modify the file as you please, including deleting it, or you cannot modify it at all. Perhaps you have to look at an option to automate backup of the file instead?
 
There really isn't a way aside from backing it up or putting it in a source control program. If somebody can edit it, they can delete the file on any system I've heard of. Even if they couldn't delete the file they could delete all the contents.
 
I don't think my co-workers could handle doing a simple back up each time.... But thanks!

I'm not saying that you should make them back it up. ;) That would be too lazy! :p

This file lives on a server, where everyone is accessing the same file, right? Or else it lives on one single computer that people walk up to?

I'm saying that you should make a cron script on the computer that owns the file and use the cron script to make backups. Shouldn't take more than 10-15 minutes to make and implement a script that saves backups periodically.... :)
 
Unix permissions give anybody with Write access Delete privileges. To do what you want to do you need to use Access Control Lists. There is more information about it here.
 
You could hide the original file in a hidden folder and make an alias point to it, then if the alias was deleted the orignal file would still be there.

It would also not be visible in the finder so draging it to the bin or Cmd+Delete would not work either.
 
Hey,

This might be considered an odd question, but I was wondering if there was a way to make a file modifiable, but not deletable.

...
When you save a modified file, you necessarily delete the old version and replace it with the new. SilentPanda is correct. You need a version control system which will allow you to access any and all previous versions of your files.
 
Using UNIX file permissions, what you can do is take away write permission from the directory that contains the file. But then, you also can't make new files in that directory. Also, as SilentPanda said, if the user can modify the file, then they can always truncate it, which means that the file remains, but it's empty.

Using Access Control Lists, on some systems, you could set that file to be Appendable/Readable/Not Writable/Not Deletable. That would mean the user could only add to the file, and read it, but not remove existing information or delete the file.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.