How to prevent folder being deleted(but changeable)

Discussion in 'macOS High Sierra (10.13)' started by pjny, Aug 8, 2018.

  1. pjny macrumors 6502a

    Joined:
    Feb 18, 2010
    #1
    Hi,

    Is there a way to prevent a folder from being accidentally deleted on Mac 10.13.6 but also allow files to be added or removed from it?

    I was grabbing a bunch of screenshots from my desktop for deletion and accidentally selected an important folder on the desktop.

    Locking the folder doesn't allow adding or removing individual files from the folder.
     
  2. Gregg2 macrumors 603

    Joined:
    May 22, 2008
    Location:
    Milwaukee, WI
    #2
    Not sure if that's possible. Just created one to delete to see if you get a warning like "Are you sure you want to move this item to the Trash?" and I didn't.

    If the folder is not backed up and you want to be sure it remains, then unlocking it when you want to add or delete something and then locking it again isn't so bad.

    Hope you find an "automatic" solution though.
     
  3. Fishrrman macrumors G5

    Fishrrman

    Joined:
    Feb 20, 2009
    #3
    OP:

    I don't think it's possible to do what you want to do.

    If you "lock the folder", you won't be able to delete items inside of it.
    You have to unlock it first.

    Why would one "lock" a file or folder in the first place? The idea is to prevent changes, right?

    I don't really see any way around this, but I consider my knowledge to be limited.

    Some additional advice (although not actually pertinent to your original question):
    Keep at least a "relatively current" backup.
    Then, in a case like this, you might have a good chance of retrieving deleted items by using the backup.

    And -- I'm the broken record on this -- there is no better way to backup than by using either CarbonCopyCloner or SuperDuper to create a BOOTABLE cloned backup of your main drive...
     
  4. FatalFallacy macrumors member

    Joined:
    Jun 12, 2013
    #4
    Not very elegant, but could do the job if you do not wanna mess too much with your user's home directory&file attributes structure:

    in Terminal:
    cd ~/Desktop
    sudo mkdir myprotecteddir
    sudo chmod 755 myprotecteddir

    ^^ will go to your current users desktop, create a folder called myprotecteddir on the desktop within the super users context, will change that only super user is able to write to, still all(beware!) other users are able to read.

    Whenever you try to delete the directory or you like to add new files you will need to authenticate with your admin password.
    However main issue with this approach is, that you won't be able to work and write directly on these files from many apps (if not launched with sudo rights), but need to save work copies.
    Still for the main purpose of 'hey, there's my archive folder with my important files, please do not accidentally delete me' this could be fine, as Finder will ask for permission.
     

Share This Page