Page 1 of 1

Block file or folder from deletion

Posted: 30 Sep 2014 21:49
by btk
I am researching but I am not able to find a solution to lock file or folder on the command line against exclusion.

Suggestions?

Re: Block file or folder from deletion

Posted: 01 Oct 2014 00:25
by foxidrive
Use attrib and hide it, delete and then remove the hidden attribute again.

It does depend on the method of deletion you are using - say Robocopy with the /mir switch won't respect this.

Re: Block file or folder from deletion

Posted: 01 Oct 2014 06:25
by btk
It is possible by command line, change file permissions?
For this is the way I wanted to do.

Re: Block file or folder from deletion

Posted: 01 Oct 2014 06:35
by ShadowThief
Yes, you can use the icacls command. http://ss64.com/nt/icacls.html

Re: Block file or folder from deletion

Posted: 01 Oct 2014 07:10
by foxidrive
btk wrote:It is possible by command line, change file permissions?
For this is the way I wanted to do.


Sometimes people ask a question and say what they want to do.

This was not one of those days. :D

Re: Block file or folder from deletion

Posted: 01 Oct 2014 07:20
by btk
ShadowThief wrote:Yes, you can use the icacls command. http://ss64.com/nt/icacls.html



Perfect !!!!
:D

Re: Block file or folder from deletion

Posted: 30 Oct 2014 06:05
by Samir
The only caveat to this command is that it does not work on FAT-based file systems (FAT, FAT32, etc) since they do not store any ACL info.