Weekend project - Directory simplifier - Shortest paths..

rh0dium steven.klass at gmail.com
Fri Jun 9 18:22:20 EDT 2006


Hi all,

OK I have two lists of directories..

Master
lista=["pad/foo/sch/filea","pad/foo/sch/fileb","pad/foo/sch/filec","pad/foo/lay/filea","pad/foo/lay/fileb","pad/foo/lay/filec","pad/bar/sch/filea","pad/bar/sch/fileb","pad/bar/sch/filec",,"pad/bar/lay/filea","pad/bar/lay/fileb","pad/bar/lay/filec","pad/zen/filea","pad/zen/fileb","pad/a",
"pad/b"]

Changed
listb=["pad/foo/sch/filea","pad/foo/sch/fileb","pad/foo/sch/filec","pad/foo/lay/filea","pad/foo/lay/fileb","pad/foo/lay/filec","pad/bar/sch/filea","pad/bar/sch/fileb","pad/bar/sch/filec",,"pad/bar/lay/filea","pad/bar/lay/filec","pad/zen/fileb",
"pad/b"]

Now what I want to get out of this is the top most directory which
could be used for a copy..  In other words I would like the results of
this to be this

final=["/pad/foo", "pad/bar/sch", "pad/bar/lay/filea",
"pad/bar/lay/filec", "pad/zen/fileb", "pad/b"]

So what I need it to do it to look backwards in the Master list and
find all similiarites in Changed..  I don't even know how to approach
this - can someone give me a hand with this.  

Thanks much!!




More information about the Python-list mailing list