[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how to check 400 files exist



On Sat, Jan 21, 2012 at 4:02 AM, Karl Vogel <vogelke+debian@pobox.com> wrote:
>>> On Thu, 19 Jan 2012 00:34:50 +0800,
>>> lina <lina.lastname@gmail.com> said:
>
> L> I am choked by how to check more than 400 files exist or not, if not,
> L> sleep, but once it's all generated, continue do something.  Those files
> L> have a common feature: sys_em_$i.txt
>
>   The script below doesn't do any glob-expansion of filenames, so it won't
>   barf if you have a lot of files.  It assumes you're in the same directory
>   as the files you're checking.
>
> --
> Karl Vogel                      I don't speak for the USAF or my company
>
> A raccoon tangled with a 23,000 volt line today.  The results blacked
> out 1400 homes and, of course, one raccoon.            --Steel City News
>
> --------------------------------------------------------------------------
> #!/bin/bash
> export PATH=/usr/local/bin:/bin:/usr/bin
>
> case "$#" in
>    0) echo need a number; exit 1 ;;
>    *) my_number=$1 ;;
> esac
>
> while :
> do
>    if [ $(find . -name 'sys_em_*.txt' -print | wc -l) == "$my_number" ]


-bash-3.2$ find . -name 'npt_*.gro' -print | wc -l
70
-bash-3.2$ if [ $(find . -name "npt_*.gro" -print | wc -l)==100 ] ;
then echo 'success' break ; fi
success break

Thanks, but seems something weird here. it's not equal to 100. I just
used this to test.


>    then
>        echo 'success'
>        break
>    fi
>
>    echo 'test'
>    sleep 5
> done
>
> echo 'done'
> exit 0
>
>
> --
> To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> Archive: [🔎] 20120120200208.79090BF8B@kev.msw.wpafb.af.mil">http://lists.debian.org/[🔎] 20120120200208.79090BF8B@kev.msw.wpafb.af.mil
>


Reply to: