Board logo

标题: 请教一个批量删除的问题 [打印本页]

作者: dddyjq1     时间: 2008-7-1 23:49    标题: 请教一个批量删除的问题

将同一目录下的所有大小为0的.TXT 文件删除,如何写? 先谢了
作者: pusofalse     时间: 2008-7-2 00:11
for %%a in (*.txt) do if %%~za equ 0 del %%~sa
作者: dddyjq1     时间: 2008-7-2 01:03
对,谢了
作者: danjiang     时间: 2008-7-2 14:31
不错,
能给解释一下 %%~za是什么意思吗?
作者: HAT     时间: 2008-7-2 18:34
for /?

  Quote:
In addition, substitution of FOR variable references has been enhanced.
You can now use the following optional syntax:

    %~I         - expands %I removing any surrounding quotes (")
    %~fI        - expands %I to a fully qualified path name
    %~dI        - expands %I to a drive letter only
    %~pI        - expands %I to a path only
    %~nI        - expands %I to a file name only
    %~xI        - expands %I to a file extension only
    %~sI        - expanded path contains short names only
    %~aI        - expands %I to file attributes of file
    %~tI        - expands %I to date/time of file
    %~zI        - expands %I to size of file
    %~$PATH:I   - searches the directories listed in the PATH
                   environment variable and expands %I to the
                   fully qualified name of the first one found.
                   If the environment variable name is not
                   defined or the file is not found by the
                   search, then this modifier expands to the
                   empty string


作者: tvzml     时间: 2008-7-9 01:10
for /f %%i in ('dir /b *.txt') do if %%~zi==0 del %%~nxi