Linux系统

linux下统计某文件夹下某类型文件的个数

时间:2017/5/16 23:55:38  作者:solgle  来源:solgle.com  查看:2050  评论:0
内容摘要:linux下统计某文件夹下某类型文件的个数
#!/bin/bash 
 set -e  ##错误终止
 # read -p "Enter Date(dataformat: YYYYMMDD):"  DATE
 path1="/home/hodp/tmp_test/"
 
 if [ ! -x $path1"$1" ]; then
     echo "the path $path1"$1 "not found"||exit
 fi
 
 
  #目录下文件数量统计
  cd /home/hodp/tmp_test/$1
  cur_path=$(pwd)
  count=$(ls -l *.txt|wc -l)
  #echo "the directory " $cur_path "the count of files(*.txt) is "$count  
  echo "Contains "$count" files(*.txt) in the folder " $cur_path 


 
标签:linux文件数量统计 

solgle.com 版权所有,欢迎分享!!!

相关文章
    相关评论
     img1 img2 img3 img4 img5 img6 img7 img8 img9 img10
    评论者:      验证码:  点击获取验证码
       Copyright © 2013-2028 solgle.com,All rights reserved.[solgle.com] 公安机关备案号:51010802000219
    Email:solgle@solgle.com; weixin:cd1008610000 ICP:蜀ICP备14011070号-1