Chinaunix首页 | 论坛 | 博客
  • 博客访问: 175993
  • 博文数量: 47
  • 博客积分: 3053
  • 博客等级: 少校
  • 技术积分: 451
  • 用 户 组: 普通用户
  • 注册时间: 2007-06-01 04:33
个人简介

malware/APT detection, silicon valley, entrepreneur, CTO, start-up operation, team build, Nanjing/Beijing, if you want to do creative things, join the adventure.

文章分类

全部博文(47)

分类: LINUX

2011-05-19 05:22:45

Count number of files in a directory
   

  1. find targetdir -type f | wc -l
        To include symbolic links, add the -follow option to find
         -maxdepth 1 prevents find from traversing into subdirectories.


Count number of files in each directory
  1. for i in `ls -al |grep '^d'|awk '{print $9}'|grep -v '\.$'`; do c=`find $i|wc -l`; echo "$c $i"; done;

1338 DOC
1067 DOCX
804 PDF
945 PPT
726 PPTX
661 RTF
873 XLS
605 XLSX

  1. for i in `ls -1b`; do c=`find $i -type f |wc -l`; echo "$c $i"; done;

阅读(1287) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~