Page 1 of 1

Is there a batch file code that prevents deleting a specific file ??

Posted: 04 Nov 2021 23:45
by Mysystem
hi
Is there a batch file code that prevents deleting a specific file ??

Re: Is there a batch file code that prevents deleting a specific file ??

Posted: 05 Nov 2021 02:30
by ShadowThief
In what context?

While looping through a list of files and deleting all of them except for a specific file? Sure.

Actively monitoring a folder and magically detecting if a file gets deleted? No, that's absurd and no such software exists for that anywhere regardless of language.

Re: Is there a batch file code that prevents deleting a specific file ??

Posted: 05 Nov 2021 04:58
by Mysystem
ShadowThief wrote:
05 Nov 2021 02:30
In what context?

While looping through a list of files and deleting all of them except for a specific file? Sure.

Actively monitoring a folder and magically detecting if a file gets deleted? No, that's absurd and no such software exists for that anywhere regardless of language.
-------------------------------------
hi
I want when I try to delete the folder from its place !

Re: Is there a batch file code that prevents deleting a specific file ??

Posted: 05 Nov 2021 07:55
by Squashman
File and Folder permissions are all controlled by the ACL for that file or folder. It should be easy enough to remove the file or folder permissions for standard users from deleting a file with ICACLS.exe but Administrators normally have full rights to do what they want. You could use ICACLS to remove the administrators from deleting the file or folder as well but I wouldn't recommend it.