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

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Mysystem
Posts: 9
Joined: 25 Oct 2021 07:00

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

#1 Post by Mysystem » 04 Nov 2021 23:45

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

ShadowThief
Expert
Posts: 1160
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

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

#2 Post by ShadowThief » 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.

Mysystem
Posts: 9
Joined: 25 Oct 2021 07:00

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

#3 Post by Mysystem » 05 Nov 2021 04:58

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 !

Squashman
Expert
Posts: 4465
Joined: 23 Dec 2011 13:59

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

#4 Post by Squashman » 05 Nov 2021 07:55

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.

Post Reply