■ Requirement : How to list out number of files inside each directory
■ OS Environment : Linux[RHEL, Centos]
■ Application: bash
■ Implementation Steps :
$ cat ./find_large_small_files.sh
#!/bin/bash
find . -type d -exec ls -d {} \; &> ./tmpfile
let i=0
for i in `cat ./tmpfile`
do
echo "Directory $i has following no of files : `ls -al $i|wc -l`"
done
rm -f ./tmpfile
■ OS Environment : Linux[RHEL, Centos]
■ Application: bash
■ Implementation Steps :
$ cat ./find_large_small_files.sh
#!/bin/bash
find . -type d -exec ls -d {} \; &> ./tmpfile
let i=0
for i in `cat ./tmpfile`
do
echo "Directory $i has following no of files : `ls -al $i|wc -l`"
done
rm -f ./tmpfile
No comments:
Post a Comment