gwdwx 发表于 2003-11-23 22:50:11

请问用什么指令可以统计出目录中文件的数目?

ls 查不到相关的参数

redhat71 发表于 2003-11-24 08:40:33

ls | wc -l

hainanxq 发表于 2003-11-24 16:22:49

根本不行,老大,你不是骗人的吧

dayanday 发表于 2003-11-25 10:15:59

可以的亚。我试过楼上的方法。
要不 ,用两步走。
ls foldername > countdir
wc –w < countdir
不过 ls | wc -l 真的好用。

redhat71 发表于 2003-11-25 16:49:15

根本不行,老大,你不是骗人的吧

# touch 1.mp3 2.mp3 3.mp3
# ls
1.mp32.mp33.mp3
# ls | wc -l
      3
# wc --help
用法:wc [选项]... [文件]...
Print byte, word, and newline counts for each FILE, and a total line if
more than one FILE is specified.With no FILE, or when FILE is -,
read standard input.
-c, --bytes            print the byte counts
-m, --chars            print the character counts
-l, --lines            print the newline counts
-L, --max-line-lengthprint the length of the longest line
-w, --words            print the word counts
      --help   显示此帮助信息并离开
      --version显示版本信息并离开

Report bugs to <[email protected]>.
#

hainanxq 发表于 2003-11-26 09:22:44

行了,谢谢redhat71老大,其实是我自己看错了,不好意思。
页: [1]
查看完整版本: 请问用什么指令可以统计出目录中文件的数目?