Results 1 to 2 of 2
Hi Friends,
I need some help. First look at my files hierchachy.
/<level-1>/<level-2>/<level-3>/*.tif
eg. :
/2010-07-01/AFFIDAVIT-OF-SERVICE---FOR-SC/001/Babylon2_20100701012049_1278004849.49892_000.tif
./2010-07-01/AFFIDAVIT-OF-SERVICE---FOR-SC/002/Babylon2_20100701012049_1278004849.49892_016.tif
./2010-07-01/AFFIDAVIT-OF-SERVICE---FOR-SC/003/Babylon2_20100701012049_1278004849.49892_035.tif
./2010-07-01/AFFIDAVIT-OF-SERVICE---FOR-SC/004/Babylon2_20100701012049_1278004849.49892_046.tif
./2010-07-01/AFFIDAVIT-OF-SERVICE---FOR-SC/005/Babylon2_20100701012049_1278004849.49892_058.tif
./2010-07-01/AFFIDAVIT-OF-SERVICE---FOR-SC/006/Babylon2_20100701012049_1278004849.49892_078.tif
./2010-07-01/AFFIDAVIT-OF-SERVICE---FOR-SC/007/Babylon2_20100701012049_1278004849.49892_096.tif
./2010-07-01/AFFIDAVIT-OF-SERVICE---FOR-SC/008/Babylon2_20100701012049_1278004849.49892_105.tif
./2010-07-01/AFFIDAVIT-OF-SERVICE---FOR-SC/009/Babylon2_20100701012049_1278004849.49892_117.tif
I want to find out the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 07-01-2011 #1Just Joined!
- Join Date
- Apr 2011
- Posts
- 23
Need to count files & create log of that.
Hi Friends,
I need some help. First look at my files hierchachy.
/<level-1>/<level-2>/<level-3>/*.tif
eg. :
/2010-07-01/AFFIDAVIT-OF-SERVICE---FOR-SC/001/Babylon2_20100701012049_1278004849.49892_000.tif
./2010-07-01/AFFIDAVIT-OF-SERVICE---FOR-SC/002/Babylon2_20100701012049_1278004849.49892_016.tif
./2010-07-01/AFFIDAVIT-OF-SERVICE---FOR-SC/003/Babylon2_20100701012049_1278004849.49892_035.tif
./2010-07-01/AFFIDAVIT-OF-SERVICE---FOR-SC/004/Babylon2_20100701012049_1278004849.49892_046.tif
./2010-07-01/AFFIDAVIT-OF-SERVICE---FOR-SC/005/Babylon2_20100701012049_1278004849.49892_058.tif
./2010-07-01/AFFIDAVIT-OF-SERVICE---FOR-SC/006/Babylon2_20100701012049_1278004849.49892_078.tif
./2010-07-01/AFFIDAVIT-OF-SERVICE---FOR-SC/007/Babylon2_20100701012049_1278004849.49892_096.tif
./2010-07-01/AFFIDAVIT-OF-SERVICE---FOR-SC/008/Babylon2_20100701012049_1278004849.49892_105.tif
./2010-07-01/AFFIDAVIT-OF-SERVICE---FOR-SC/009/Babylon2_20100701012049_1278004849.49892_117.tif
I want to find out the list of level-3 folders, which contain more that 2 TIF images. I want list of full path from date to that tif image.
- 07-01-2011 #2Trusted Penguin
- Join Date
- May 2011
- Posts
- 3,673
This assumes that the level-1 directory is 2010-07-01, but you could modify that, too...
Code:#!/bin/bash dirs=$(find /2010-07-01/*/* -type d) for dir in $dirs; do echo -e "\nDir: $dir" declare -a files files=($(find $dir -type f -name '*.tif')) echo Files: ${#files[*]} if [ ${#files[*]} -gt 2 ]; then for file in ${files[*]}; do echo $file done fi done


Reply With Quote
