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

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 03 June 2005