I'm trying to write a batch file, that would delete all files and directories in DELETE directory, except for a few "important" ones. I've tried to add attributes Hidden and System to the important files/directories. While it seems to work on the "del" command, "rmdir" still removes everything, regardless of attributes.
@echo on attrib important.txt +s +h attrib folder +s +h attrib picture.bmp +s +h attrib delete.bat +s +h del *.* rmdir /s /q C:UsersLenovoDesktopDELETE attrib important.txt -s -h attrib folder -s -h attrib picture.bmp -s -h attrib delete.bat -s -h pause
Is there any way to do it?