Board logo

标题: 如何删除所有的空目录? [打印本页]

作者: wl00560     时间: 2005-12-26 19:36    标题: 如何删除所有的空目录?

有一个大型目录,里面有很多空目录,或者二级或者三级,或者四级,没有准。怎样才能一次性地删除这些空目录,dos与windows方法都可以。望各位兄弟帮助一下。
作者: maji     时间: 2005-12-27 07:43
在DRDOS里有一个XDEL的外部命令,可以达到你的目的。

XDEL R1.42    Extended file delete
Copyright (c) 1987,1988,1990 Digital Research Inc. All rights reserved.

XDEL [/Help]   [@][d:][path]filename[.ext]...  [/options]

  @             the filename that follows is the name of a file list
  d:            drive which xdel is to search
  path          directory where search is to begin
  filename.ext  file to be deleted (wildcards allowed)

  /D            remove empty subdirectories
  /N            delete specified files with no warning (careful!)
  /O            overwrite before deleting - file contents PERMANENTLY LOST
  /P            prompt before deleting each file
  /R            delete read-only files
  /S            delete files in subdirectories

Multiple files may be specified on the command line.
作者: kaixinguo     时间: 2005-12-27 08:33
用这个批处理就可以了。
dir /ad/b/s c:\ |sort /r >c:\kill.txt
For /f "tokens=*" %%i in (c:\kill.txt) DO rd "%%i"
del c:\kill.txt
作者: maji     时间: 2005-12-27 08:38
3楼高啊,又学到一招!
作者: wl00560     时间: 2005-12-27 16:23
谢谢3楼的兄弟,问题解决。