alanzchen/rm-protection

Can support automatic file recursive protection in the folder

jamestotti opened this issue · 6 comments

Can support automatic file recursive protection in the folder?

For example: to protect the mysql directory folder, after entering the mysql directory can not delete the current directory of the file

Did you mean: if a parent directory is protected, all the files inside should also be recursively protected?

I think it might be similar to the "-r" parameter for some commands, such as ’cp‘ or 'mv'.

@apocelipes

Recursively protect every file inside a directory? Personally I won't encourage this behaviour, since "protecting everything is protecting nothing".

Currently you can protect folder but it won't protect anything inside it. (That is, it only shields you from rm -rf folder, but not rm -rf folder\*).

If anything inside a folder is protected, it will prompt to ask.

Well,thank you for telling me that 'protecting everything is protecting nothing'.

Hi,

Under the branch recursive-protection, now you can protect directories using protect -R dir. This will add an additional flag R in the third line of a protection file so it now looks like:

Question
Answer
R

For each argument that rm-p receives, rm-p will check if any of its parent directories is protected and has a flag R in the protection file. If so, rm-p will prompt.

Feel free to try it out and I will publish it on PyPi when it is well tested.

Thanks!

#7 should resolve this issue.