Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- List of protected directories
- local protectedDirs = {
- ["/disk/os"] = true,
- ["/disk/boot"] = true,
- ["/disk/bootloader"] = true
- }
- -- Function to check if the path is protected
- local function isProtected(path)
- return protectedDirs[path]
- end
- -- Override the os.remove function
- local oldRemove = os.remove
- os.remove = function(path)
- if isProtected(path) then
- print("Are you sure you want to delete this protected directory? (Y/N)")
- local answer = read()
- if answer:lower() == "y" then
- oldRemove(path)
- else
- print("Deletion cancelled.")
- end
- else
- oldRemove(path)
- end
- end
- -- Constantly run to intercept deletion attempts
- while true do
- os.pullEvent() -- Wait for an event to keep the script running
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement