Michael Maardt: PC since 1984 • on the net since 1990.

Get the most out of your PCDOS tips

Deleting all files in a directory

Another reader wrote me (thank you) with a neat suggestion for avoiding those time-wasting Are you sure? messages. Honestly, Microsoft can?t have a very high opinion of us users and our IQs. Write a batch file called, for example, ERASE.BAT that contains the following:

echo y | del *.*

When you want to delete all files in a directory, at the DOS prompt type: erase.

If you have installed a large program that has created many sub-directories, and you want to delete all of these directories and their contents from disk, there is only one way to do so in DOS 5: the long, hard way, starting "backwards" with the "deepest" directory and deleting one sub-directory at a time. Windows File Manager and the DOS 6 command Deltree can delete a directory with associated sub-directories with one keystroke.

C:\>DELTREE C:\EXTRA and answer Y.

You will often have to delete all files on a diskette. I make it a habit to check exactly what I am about to delete, so I use NC and Alt+F1, look in the files and write ERASE at the prompt to run my batch file. If there are many directories on the diskette, consider quick formatting it by typing

C:\>FORMAT/Q A:

or an unconditional formatting (you cannot UNFORMAT it afterwards) by typing

C:\>FORMAT/Q/U A:

CHKDSK /F

I have mentioned this several times in this little guide. Before DOS 6.2, when this program was replaced by SCANDISK, it was used to repair disk errors. If you have DOS 6.2, you can use SCANDISK instead of CHKDSK.

A typical error (from CHKDSK) on a disk is lost clusters or cross-linked files. Lost clusters are bits of data that do not have a name attached to them, while cross-linked files refer to a condition where two files share, or are linked to, the same place on a disk.

Lost clusters: If it finds any, answer YES to fix them. They will be named in a sequence starting with FILE0000.CHK and will be placed in your root directory. Inspect them and decide whether to keep them (rename the file or files with a more meaningful name) or delete them.

Cross-linked files: If CHKDSK reports crosslinked files make a note of the filenames, copy the files under a new name to somewhere else on the disk, and delete the originals. That also removes the link to the same place on the disk.

From, to

This may not be very relevant for English-speaking readers, but I?m including it because this command gives you the chance to revert to your computer?s internal symbol set. If the DEL key on the number pad on your PC produces a comma instead of a period, as it does on many European machines, you can change it by pressing Ctrl+Alt+F1 (change it back by pressing Ctrl+Alt+F2). This toggles between the internal symbol set in your PC and the standard you have set in your startup files.

It works at the command prompt in DOS programs and in a DOS box in Windows. You lose any other country-specific symbols. So you will have to experiment with the ?/$ sign and so on to see if you still have them, or to discover where they have been moved to. In any event, you can just swap back and forth between hardware and software symbol sets as you wish.

FDISK

This program, used to partition a hard disk before it is formatted, has an undocumented switch that is quite harmless, but in some circumstances can remove a virus in the master boot record:

C:\>FDISK/MBR

Facebook Twitter Google LinkedIn Emailemail to friend

You are on michaelmaardt.com • © Michael Maardt 21. Jul. 2018