【问题标题】:How to delete a specific file, in a specific location, if the file is larger than given size, in a batch file如果文件大于给定大小,如何在批处理文件中删除特定位置的特定文件
【发布时间】:2014-08-21 19:21:11
【问题描述】:

如果文件大于给定大小,如何在批处理文件中删除特定位置的特定文件。

基本上我要做的是创建一个批处理文件,如果它的大小大于 100mb,则在运行时将始终删除特定文件。

【问题讨论】:

    标签: batch-file command dos


    【解决方案1】:
    for %%a in ("c:\somewhere\theFile.txt") do if %%~za gtr 104857600 del "%%~fa"
    

    for 命令将在其可替换参数%%a 中获得对指定文件的引用。那么%%~za会返回被引用文件的大小,%%~fa是文件名和完整路径。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-03
      • 2013-05-31
      • 2023-01-10
      • 1970-01-01
      • 2017-02-03
      • 1970-01-01
      相关资源
      最近更新 更多