some modification on instpkg
[cmdllinux.git] / scripts / _find_files_in_dirs.sh
blob5b1e52166d246080737a142df612bed75be468d0
1 [ "$1" = "-n" ] && n_empty=1 && shift
2 [ -z "$1" ] && exit 1
3 EXT="$1"
4 #echo $DIR - if param then print files
5 find -mindepth 1 -maxdepth 1 -type d | sort | \
6 while read DIR; do
7 if [ -z "$n_empty" ]; then
8 (cd $DIR && find -type f -name "*.$EXT") | xargs echo $DIR
9 else
10 (cd $DIR && find -type f -name "*.$EXT") | xargs -r echo $DIR
12 done