Philip Potter <philip.g.pot...@gmail.com> writes:
> haven't explained *why* you are doing this comparison in this thread.
> [You might have done elsewhere, but I don't read every thread.]

Uri actually did (most of) it for me at one point in a recent post on
this thread.  Message-ID: <87mxwgbvyo....@quad.sysarch.com> on
              gmane.comp.lang.perl.beginners

This is probably overly verbose... as I am not very good at explain
the full project simply.
 
 Project: Merge two directory structures that contain:

Many files in one and not the other
But different thing have to happen in each structures case.

1)
   A larger structure has many files not contained in a smaller
   structure. Those files need to disappear.

2)
  The smaller structure has many files not present in the larger
  structure. Those files need to remain.

NOTE: Those two chores are in hand... due to excellent examples
      supplied here.

3) Of the remaining files: 
   Many of them have the same final (end name) but different
   paths... besides the obvious difference of root path.
   
   b1/some/path/file  (from larger hierarch)
   b2/path/file       (from smaller hierarch)
   
   But also there are many cases where the end name is the same but
   the files themselves are different.  (Those are handled through a
   dispatch table of functions.  One being to check the files size
   and another supplies command line to diff the files.).  In fact
   usually the size is enough to make a choice.
   
   So, if they are the same file then the file from the larger
   structure will be moved to new base and over the path of the
   smaller structure.. That sounds too confusing but illustration will
   show is not really:

   b1/some/path/file
   b2/path/file
   
   b1 file will be moved to
   b3/path/file

   Overwriting the file from b2.

The final confusion is that all this is not really being done, but is
generating a list of cmds that will do the complete job.

What will happen in the end is all of b2 will be left and all
identical files from b1 will overwrite there twin by being move to
the twins address.  Whatever is in b1 that isn't in b2 at all will be
deleted. 


In step 1.  rm (b1) [ files not in b2]

   step 2)  add (b2) [ files not in b1 ]

   step 3)  mv matching b1 over there twin in b2

The equivalent cmds will be carried out inside a Distributed
Versioning System called `git'.

I'm not familiar yet with git.  At least not much, but can generate a
list of cmds to be carrried out by that program.  

-------        ---------       ---=---       ---------      -------- 
I now have those chores listed above in hand due to the helpful
responses here.  The full program is nearly complete
Just having some trouble getting the dispatch table boiled down to its
most usable incarnation.

If I strike out on that or need a nudge... I'll probably post
something on a new thread.  But again it will be about the part
concerning dispatch tables.  Not the whole project.

I will be much more careful with any examples of what I need.  The
sharp eyed experts here will get sick of me pretty soon if I don't
give better examples.   I'll get sick of me too....


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to