[ale] Stumped-

Richard Bronosky Richard at Bronosky.com
Thu Mar 11 12:32:41 EST 2010


Thank you Scott! This is a VERY important point here. ( see:
http://www.linuxjournal.com/article/6060 ) And, it goes along with my
argument that the script needs to be called for each client dir. It
should not walk over the client dirs itself. So I'll re-stress this
issue. The script should receive 2 dirs as arguments like so:
    compare_script.sh client1/images client1/movies

If you do that, then you will end up with a script that is useful to
you for other comparisons in the future. Going back to Scott's point,
the way to run the script on a large number of client dirs is:
find . -type d -maxdepth 1 -exec ./compare_script.sh {}/images
{}/movies \; # don't forget the escaped trailing semi-colon.

You can see this design pattern in action with:
find $HOME -type d -maxdepth 1 -exec ls -ld {} \;

The rest is pretty simple:
• stat for files size testing
• http://mywiki.wooledge.org/BashFAQ for how to use arrays
• http://mywiki.wooledge.org/BashPitfalls to avoid wasting your time


On Thu, Mar 11, 2010 at 10:58 AM, Scott McBrien <smcbrien at gmail.com> wrote:
> Dennis,
>
> You're likely going to have problems with the $(ls) to generate the
> stuff for your for loop.  I've had problems with large volume of
> arguments provided with for, so you may need to swich to a while loop
> out of a file of clients.
>
> What I'd try is using find to populate a list of client files, the
> sort them using the last field so that you get the files with the same
> name grouped together.  Then instead of ls, maybe stat would give you
> the size that's easier to grab.
>
> -Scott
>
> On Mar 11, 2010, at 7:31 AM, Dennis Ruzeski <denniruz at gmail.com> wrote:
>
>> The direction  I've been going in is to do something like this-
>>
>> for dir in `ls /client`
>> do diff -s $dir/images $dir/movies |grep ^F |xargs ls -l
>> done
>>
>>
>>
>> On Thu, Mar 11, 2010 at 10:26 AM, Dennis Ruzeski
>> <denniruz at gmail.com> wrote:
>>> Same name but different size.
>>>
>>>
>>>
>>> On Thu, Mar 11, 2010 at 10:14 AM, Dave Weiner <davew at coyotetechnical.com
>>> > wrote:
>>>> Dennis Ruzeski wrote:
>>>>> Exactly- I need to look in images and movies for the same file name
>>>>> with different sizes for each client.
>>>>
>>>> So you need to loop through all the files in the images dir for
>>>> client1
>>>> and check for files with the same name in the other 9,999 image
>>>> directories?
>>>>
>>>>>
>>>>> --Dennis
>>>>
>>>> Dave
>>>> _______________________________________________
>>>> Ale mailing list
>>>> Ale at ale.org
>>>> http://mail.ale.org/mailman/listinfo/ale
>>>> See JOBS, ANNOUNCE and SCHOOLS lists at
>>>> http://mail.ale.org/mailman/listinfo
>>>>
>>>
>> _______________________________________________
>> Ale mailing list
>> Ale at ale.org
>> http://mail.ale.org/mailman/listinfo/ale
>> See JOBS, ANNOUNCE and SCHOOLS lists at
>> http://mail.ale.org/mailman/listinfo
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo
>



-- 
.!# RichardBronosky #!.



More information about the Ale mailing list