请问用什么指令可以统计出目录中文件的数目?
ls 查不到相关的参数 ls | wc -l 根本不行,老大,你不是骗人的吧 可以的亚。我试过楼上的方法。要不 ,用两步走。
ls foldername > countdir
wc –w < countdir
不过 ls | wc -l 真的好用。 根本不行,老大,你不是骗人的吧
# 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]>.
# 行了,谢谢redhat71老大,其实是我自己看错了,不好意思。
页:
[1]