Q: I accidentally deleted all the files in the root directory of my hard disk for the second time this month. I managed to reinstall everything, but is there a way of avoiding the problem?
A: There are two approaches you could try, both of which have applications for other things too:
- Modify the files so that they cannot be deleted without first explicitly making them deletable. You can do this with the DOS utility Attrib which was supplied with your system. … To protect the file use the command:
ATTRIB +R filename
The +R switch means “make this file read-only”.
- Stop using the DEL command to delete files. Use a batch file instead which will prompt you before taking action.
… <batch file code is given> …
This batch file has a useful enhancement beyond the precautionary message. You can use it to specify multiple files, for example:
DF *.BAK FRED.BAS ?.DOC
With one command this would delete all .BAK files, FRED.BAS, and all .DOC files whose names begin with a single letter.
A delete command which takes multiple arguments – wow…