[ale] Stumped-

Richard Bronosky Richard at Bronosky.com
Fri Mar 12 02:14:31 EST 2010


I've wrote a very functional script for you here:
http://gist.github.com/330096

I still feel that, David A. De Graaf and others have noted, your needs still
aren't completely clear. So, instead of continuing to try to get solid
specification out of you, I figured I give you something to try out and then
you would likely realize what needs to be changed. I broke it down and
documented it so you can modify it to meet your needs. But please give it a
try. It's got a built in demo that generates its own test data. All you have
to do is use it as described below and give me feedback.

You can see it in action by copying and pasting this in your shell:
wget
http://gist.github.com/raw/330096/0ca31670b30d344515bb39fae2f9c75b59c18392/compare_script.sh
chmod +x compare_script.sh
awk '/BEGIN UNIT TEST/{p=1};p==1{print}' compare_script.sh | bash

This is the output you would see:
~$ wget
http://gist.github.com/raw/330096/0ca31670b30d344515bb39fae2f9c75b59c18392/compare_script.sh
--2010-03-12 02:05:49--
http://gist.github.com/raw/330096/0ca31670b30d344515bb39fae2f9c75b59c18392/compare_script.sh
Resolving gist.github.com... 207.97.227.243
Connecting to gist.github.com|207.97.227.243|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3273 (3.2K) [text/plain]
Saving to: `compare_script.sh'

100%[===========================================================================================================>]
3,273       --.-K/s   in 0.03s

2010-03-12 02:05:50 (115 KB/s) - `compare_script.sh' saved [3273/3273]

~$ chmod +x compare_script.sh
~$ awk '/BEGIN UNIT TEST/{p=1};p==1{print}' compare_script.sh | bash
Creating client directories in /tmp/ for testing...
Removing /tmp/client01 /tmp/client02 /tmp/client03 /tmp/client04
/tmp/client05 /tmp/client06 /tmp/client07 /tmp/client08 /tmp/client09
/tmp/client10
Create a dir structure to prove that it works on deep dirs
Create 10 files in each dir
Copy the images dir over to a movies dir
Remove a file from each of the images dirs
Remove a different file from each of the movies dirs
Put some alternate data in to create non-matching filesizes
Create 10 /tmp/clients (they'll all be the same, but you get the point)
Run the script on all client directories


/tmp/client01/images/landscape/asset03.ext
/tmp/client01/images/landscape/asset04.ext
/tmp/client01/images/landscape/asset06.ext
/tmp/client01/images/landscape/file03.ext
/tmp/client01/images/landscape/file04.ext
/tmp/client01/images/landscape/file06.ext
/tmp/client01/images/landscape/thumbnails/thumbnail03.ext
/tmp/client01/images/landscape/thumbnails/thumbnail04.ext
/tmp/client01/images/landscape/thumbnails/thumbnail06.ext
/tmp/client02/images/landscape/asset03.ext
/tmp/client02/images/landscape/asset04.ext
/tmp/client02/images/landscape/asset06.ext
/tmp/client02/images/landscape/file03.ext
/tmp/client02/images/landscape/file04.ext
/tmp/client02/images/landscape/file06.ext
/tmp/client02/images/landscape/thumbnails/thumbnail03.ext
/tmp/client02/images/landscape/thumbnails/thumbnail04.ext
/tmp/client02/images/landscape/thumbnails/thumbnail06.ext
/tmp/client03/images/landscape/asset03.ext
/tmp/client03/images/landscape/asset04.ext
/tmp/client03/images/landscape/asset06.ext
/tmp/client03/images/landscape/file03.ext
/tmp/client03/images/landscape/file04.ext
/tmp/client03/images/landscape/file06.ext
/tmp/client03/images/landscape/thumbnails/thumbnail03.ext
/tmp/client03/images/landscape/thumbnails/thumbnail04.ext
/tmp/client03/images/landscape/thumbnails/thumbnail06.ext
/tmp/client04/images/landscape/asset03.ext
/tmp/client04/images/landscape/asset04.ext
/tmp/client04/images/landscape/asset06.ext
/tmp/client04/images/landscape/file03.ext
/tmp/client04/images/landscape/file04.ext
/tmp/client04/images/landscape/file06.ext
/tmp/client04/images/landscape/thumbnails/thumbnail03.ext
/tmp/client04/images/landscape/thumbnails/thumbnail04.ext
/tmp/client04/images/landscape/thumbnails/thumbnail06.ext
/tmp/client05/images/landscape/asset03.ext
/tmp/client05/images/landscape/asset04.ext
/tmp/client05/images/landscape/asset06.ext
/tmp/client05/images/landscape/file03.ext
/tmp/client05/images/landscape/file04.ext
/tmp/client05/images/landscape/file06.ext
/tmp/client05/images/landscape/thumbnails/thumbnail03.ext
/tmp/client05/images/landscape/thumbnails/thumbnail04.ext
/tmp/client05/images/landscape/thumbnails/thumbnail06.ext
/tmp/client06/images/landscape/asset03.ext
/tmp/client06/images/landscape/asset04.ext
/tmp/client06/images/landscape/asset06.ext
/tmp/client06/images/landscape/file03.ext
/tmp/client06/images/landscape/file04.ext
/tmp/client06/images/landscape/file06.ext
/tmp/client06/images/landscape/thumbnails/thumbnail03.ext
/tmp/client06/images/landscape/thumbnails/thumbnail04.ext
/tmp/client06/images/landscape/thumbnails/thumbnail06.ext
/tmp/client07/images/landscape/asset03.ext
/tmp/client07/images/landscape/asset04.ext
/tmp/client07/images/landscape/asset06.ext
/tmp/client07/images/landscape/file03.ext
/tmp/client07/images/landscape/file04.ext
/tmp/client07/images/landscape/file06.ext
/tmp/client07/images/landscape/thumbnails/thumbnail03.ext
/tmp/client07/images/landscape/thumbnails/thumbnail04.ext
/tmp/client07/images/landscape/thumbnails/thumbnail06.ext
/tmp/client08/images/landscape/asset03.ext
/tmp/client08/images/landscape/asset04.ext
/tmp/client08/images/landscape/asset06.ext
/tmp/client08/images/landscape/file03.ext
/tmp/client08/images/landscape/file04.ext
/tmp/client08/images/landscape/file06.ext
/tmp/client08/images/landscape/thumbnails/thumbnail03.ext
/tmp/client08/images/landscape/thumbnails/thumbnail04.ext
/tmp/client08/images/landscape/thumbnails/thumbnail06.ext
/tmp/client09/images/landscape/asset03.ext
/tmp/client09/images/landscape/asset04.ext
/tmp/client09/images/landscape/asset06.ext
/tmp/client09/images/landscape/file03.ext
/tmp/client09/images/landscape/file04.ext
/tmp/client09/images/landscape/file06.ext
/tmp/client09/images/landscape/thumbnails/thumbnail03.ext
/tmp/client09/images/landscape/thumbnails/thumbnail04.ext
/tmp/client09/images/landscape/thumbnails/thumbnail06.ext
/tmp/client10/images/landscape/asset03.ext
/tmp/client10/images/landscape/asset04.ext
/tmp/client10/images/landscape/asset06.ext
/tmp/client10/images/landscape/file03.ext
/tmp/client10/images/landscape/file04.ext
/tmp/client10/images/landscape/file06.ext
/tmp/client10/images/landscape/thumbnails/thumbnail03.ext
/tmp/client10/images/landscape/thumbnails/thumbnail04.ext
/tmp/client10/images/landscape/thumbnails/thumbnail06.ext

On Thu, Mar 11, 2010 at 1:22 PM, Lightner, Jeff <jlightner at water.com> wrote:
> Part of the issue may be the asynchronous way replies hit the list.
>
> By the time one's post hits the list its contents may have been obviated
by other posts that weren't there at the time it was submitted.  The OP
wasn't clear in whether he was looking for differences between multiple
clients or just within the subdirectories of each client so some of the
posts addressed what they thought he was asking.
>
> The OP clarified what he was asking and what I wrote would do what he
asked  based on my testing.  I haven't tested the other solutions so they
may be better or worse than mine.
>
> -----Original Message-----
> From: ale-bounces at ale.org [mailto:ale-bounces at ale.org] On Behalf Of
Richard Bronosky
> Sent: Thursday, March 11, 2010 12:44 PM
> To: Atlanta Linux Enthusiasts - Yes! We run Linux!
> Subject: Re: [ale] Stumped-
>
> The multiple clients thing is extraneous info and I wish we could all
> forget it. It's like describing what you had for breakfast in the
> middle of your task explanation. They would eat you up for this line
> of questioning on irc://irc.freenode.net/#bash (which is a GREAT
> resource!) I think this explains it pretty well:
> [12:39pm] RichardBronosky: !b1
> [12:39pm] greybot: bashphorism 1: the questioner's first description
> of the problem/question will be misleading.
>
> On Thu, Mar 11, 2010 at 12:32 PM, Geoffrey <lists at serioustechnology.com>
wrote:
>> Dennis Ruzeski wrote:
>>> Just to be clear--
>>>
>>> Per client, I need to find files with the same name but different sizes.
>>
>> Oops, so you're not comparing client to client?  My script I sent
>> earlier will still work, you just need to run it from the clients
directory.
>>
>>>
>>>
>>> On Thu, Mar 11, 2010 at 10:32 AM, Dave Weiner <davew at coyotetechnical.com>
wrote:
>>>> Dennis Ruzeski wrote:
>>>>> Same name but different size.
>>>> I got that part, but are you comparing files limited to just the
client,
>>>> or do you have to compare it against the other 9,999 clients?
>>>>
>>>> If it's contained to just the one client, you can't have two files with
>>>> the same name in the same directory with different sizes.
>>>>
>>>> You need to better explain what you are trying to do.
>>>>
>>>> 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
>>>
>>
>>
>> --
>> Until later, Geoffrey
>>
>> "I predict future happiness for America if they can prevent
>> the government from wasting the labors of the people under
>> the pretense of taking care of them."
>> - Thomas Jefferson
>> _______________________________________________
>> 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 #!.
>
> _______________________________________________
> 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
>
> Proud partner. Susan G. Komen for the Cure.
>
> Please consider our environment before printing this e-mail or
attachments.
> ----------------------------------
> CONFIDENTIALITY NOTICE: This e-mail may contain privileged or confidential
information and is for the sole use of the intended recipient(s). If you are
not the intended recipient, any disclosure, copying, distribution, or use of
the contents of this information is prohibited and may be unlawful. If you
have received this electronic transmission in error, please reply
immediately to the sender that you have received the message in error, and
delete it. Thank you.
> ----------------------------------
>
> _______________________________________________
> 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 #!.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.ale.org/pipermail/ale/attachments/20100312/ae2d509f/attachment-0001.html 


More information about the Ale mailing list