DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Working with DOS

Removing a DOS directory

To remove an empty DOS directory, use the dosrmdir command (see doscmd(C) for details), as follows:

dosrmdir directory

For example, to remove a directory called PROJECTS from the A: drive, type the following:

   $ dosrmdir a:projects
Before you remove a directory, you must make sure that it does not contain any files or subdirectories. If it is not empty, you must either delete the files it contains (using dosrm), or move them to other directories (using doscp to copy the files to a different directory, followed by dosrm to remove the files from the directory to be removed).

The following is a short script to remove all the files from a DOS directory:

   #!/bin/sh
   for target in `dosls $1`
   do
       dosrm $1/${target}
   done
For example, if the script is named dosdirempty, and your disk in drive A: contains a directory called work, you would type the following in order to remove all the contents of the work directory:
   $ dosdirempty A:WORK

Next topic: Formatting a DOS floppy
Previous topic: Creating a DOS directory

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003