中国DOS联盟论坛

中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --
联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
游客 | 登录 | 注册 | 会员 | 搜索 | 中国DOS联盟
中国DOS联盟论坛
现在时间是 2026-08-18 17:03
47,814 主题排行 / 349,908 发帖 / 今日 1 篇 / 48,259 会员排行
DOS疑难解答 & 问题讨论 (解答室) » 怎样用DIR找指定大小的文件
可打印版本  1,524 / 7
第1楼 bob1989 发表于 2007-02-07 07:10
中级用户 发帖 144 积分 322
怎样用DIR找指定大小的文件
朋友发了一张5M多的JPG图片给我
请问我用DIR怎么找到这个JPG文件 我的电脑里还有6M的JPG
我只想让他显示5~6M的JPG文件
请问整样做
第2楼 oilio 发表于 2007-02-07 09:12
高级用户 发帖 303 积分 641
我来抛砖引玉一下。这个好像只用dir是做不到的,需要和其它的配合才有可能做到。dir可以按文件大小排序列出,也应该比较好找一些。 可以这样只列出.jpg格式的文件,然后把.jpg的文件按大小排序。
dir *.jpg /a-d/os这样可以列出当前目录下的所有jpg格式文件,默认是从小到大的顺序排列,也可以在o和s之间加一个减号。就会从大到小排。我知道的只有这么多,希望可以帮到你。祝你好运。

[ Last edited by oilio on 2007-2-6 at 08:24 PM ]
第3楼 bob1989 发表于 2007-02-08 06:08
中级用户 发帖 144 积分 322
这个我也知道啊` DIR + FOR + SET 能判断吗`?

我只要他能显示出来就可以了 不追求什么格式
第4楼 vkill 发表于 2007-02-08 06:31
金牌会员 发帖 1,744 积分 4,103 来自 甘肃.临泽
for %? in ('dir ') do if 5.. lss %~z?

大概这个意思,自己试吧
第5楼 DOSforever 发表于 2007-02-11 16:54
金牌会员 发帖 2,239 积分 4,639
我又要来宣传一下 4DOS 了

只想让他显示5~6M的JPG文件:

dir/ *.jpg

dir/ *.jpg

就这么简单


4DOS Help Topic: Size Ranges


Size ranges simply select files whose size is between the limits given. For
example, / selects files between 10,000 and 20,000 bytes long.

Either or both values in a size range can end with "k" to indicate thousands
of bytes, "K" to indicate kilobytes (1,024 bytes), "m" to indicate millions
of bytes, or "M" to indicate megabytes (1,048,576 bytes). For example, the
range above could be rewritten as /.

The second argument of a size range is optional. If you use a single
argument, like /, you will select files of that size or larger. You
can also precede the second argument with a plus sign ; when you do, it
is added to the first value to determine the largest file size to include in
the search. For example, / select files from 10,000 through
11,000 bytes in size.

Some further examples of size ranges:

Specification Selects Files

/ of length zero (empty)
/ 1 megabyte or more in length
/ between 10,000 and 10,200 bytes
第6楼 bob1989 发表于 2007-02-14 04:30
中级用户 发帖 144 积分 322
E:\Documents and Settings\new>dir/[s5000000,60000000] *.jpg
无效的命令行开关 - "[s5000000"。
第7楼 Michael 发表于 2007-02-14 06:38
钻石会员 发帖 3,041 积分 10,056
楼上的老大。。。。。。
第8楼 qingfushuan 发表于 2007-02-14 22:20
高级用户 发帖 327 积分 502
试了试
@echo off
for /f "tokens=3,4 skip=5 " %%a in ('dir /a-d *.jpg') do echo %%a %%b >>1.txt
for /f "tokens=1,2 delims=," %%a in (1.txt) do echo %%a%%b >>2.txt
for /f "tokens=1,2" %%a in (2.txt) do if %%a geq 50000 move %%b c:\temp 2>nul
del 1.txt 2.txt
pause

就是中间文件太多了,水平有限,望过往高手指教
[ 联系联盟系统管理团队 - 中国DOS联盟 - 标准版 ]
Sponsored by ifanr Inc | © 2001–2023