中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

中国DOS联盟论坛
现在时间是 2026-07-01 02:06
中国DOS联盟论坛 » DOS疑难解答 & 问题讨论 (解答室) » 怎样用DIR找指定大小的文件 查看 1,447 回复 7
楼 主 怎样用DIR找指定大小的文件 发表于 2007-02-07 07:10 ·  中国 湖南 衡阳 电信
中级用户
★★
积分 322
发帖 144
注册 2007-01-10 13:00
19年会员
UID 76062
性别 男
状态 离线
朋友发了一张5M多的JPG图片给我
请问我用DIR怎么找到这个JPG文件 我的电脑里还有6M的JPG
我只想让他显示5~6M的JPG文件
请问整样做
2 发表于 2007-02-07 09:12 ·  中国 江苏 连云港 联通
高级用户
★★★
前进者
积分 641
发帖 303
注册 2007-01-10 02:57
19年会员
UID 76009
性别 男
状态 离线
我来抛砖引玉一下。这个好像只用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 发表于 2007-02-08 06:08 ·  中国 湖南 衡阳 电信
中级用户
★★
积分 322
发帖 144
注册 2007-01-10 13:00
19年会员
UID 76062
性别 男
状态 离线
这个我也知道啊` DIR + FOR + SET 能判断吗`?

我只要他能显示出来就可以了 不追求什么格式
4 发表于 2007-02-08 06:31 ·  中国 甘肃 兰州 电信
金牌会员
★★★★
积分 4,103
发帖 1,744
注册 2006-01-20 13:00
20年会员
UID 49241
性别 男
来自 甘肃.临泽
状态 离线
for %? in ('dir ') do if 5.. lss %~z?

大概这个意思,自己试吧
5 发表于 2007-02-11 16:54 ·  中国 上海 电信
金牌会员
★★★★
积分 4,639
发帖 2,239
注册 2005-01-30 00:00
21年会员
UID 35785
性别 男
状态 离线
我又要来宣传一下 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 发表于 2007-02-14 04:30 ·  中国 湖南 衡阳 电信
中级用户
★★
积分 322
发帖 144
注册 2007-01-10 13:00
19年会员
UID 76062
性别 男
状态 离线
E:\Documents and Settings\new>dir/[s5000000,60000000] *.jpg
无效的命令行开关 - "[s5000000"。
7 发表于 2007-02-14 06:38 ·  中国 山东 济宁 联通
钻石会员
★★★★★
积分 10,046
发帖 3,039
注册 2002-11-11 00:00
23年会员
UID 223
性别 男
状态 离线
楼上的老大。。。。。。
简单就是美
8 试了试 发表于 2007-02-14 22:20 ·  中国 四川 绵阳 江油市 电信
高级用户
★★★
积分 502
发帖 327
注册 2006-12-30 06:01
19年会员
UID 74981
性别 男
状态 离线
@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

就是中间文件太多了,水平有限,望过往高手指教
论坛跳转: