I have some folder ~/foo which I'd like to protect from accidental deletion, that is I'd like to protect it from deleting with rm -r ~/foo or rmdir ~/foo.
I realized you can do that using chmod a-w ~/foo or chattr -i ~/foo but this has the drawback that you cannot change anything inside that folder. I however would still like to be able to create/move/delete files and folders inside ~/foo.
Is it somehow possible to do so?