#!/bin/bash
file_count=0
folder_count=0
function TRAVEL_ALL_FILE(){
       for file in *;
        do
        if [ -f ${file} ];then    #normal file
                echo ${file}
                ((file_count++))
        elif [ -d ${file} ];then   #dir
                cd ${file}
                ((folder_count++))
                TRAVEL_ALL_FILE
                cd ..
        fi
        done
}
 
TRAVEL_ALL_FILE
echo "There are $file_count files and $folder_count folders in : ";pwd    

 

相关文章:

  • 2021-06-11
  • 2022-01-06
  • 2021-07-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-01
  • 2021-06-06
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案