Matching Directory Names and Grouping Them

J wilder.usenet at gmail.com
Thu Jan 11 18:38:22 EST 2007


Steve-

Thanks for the reply. I think what I'm trying to say by similar is
pattern matching. Essentially, walking through a directory tree
starting at a specified root folder, and returning a list of all
folders that matches a pattern, in this case, a folder name containing
a four digit number representing year and a subdirectory name
containing a two digit number representing a month. The matches are
grouped together and written into a text file. I hope this helps.

Kind Regards,
J

Steve Holden wrote:
> J wrote:
> > Hello Group-
> >
> > I have limited programming experience, but I'm looking for a generic
> > way to search through a root directory for subdirectories with similar
> > names, organize and group them by matching their subdirectory path, and
> > then output their full paths into a text file. For example, the
> > contents of the output text file may look like this:
> >
> > <root>\Input1\2001\01\
> > <root>\Input2\2001\01\
> > <root>\Input3\2001\01\
> >
> > <root>\Input1\2002\03\
> > <root>\Input2\2002\03\
> > <root>\Input3\2002\03\
> >
> > <root>\Input2\2005\05\
> > <root>\Input3\2005\05\
> >
> > <root>\Input1\2005\12\
> > <root>\Input3\2005\12\
> >
> > I tried working with python regular expressions, but so far haven't
> > found code that can do the trick. Any help would be greatly
> > appreciated. Thanks!
> >
> Define "similar".
>
> regards
>   Steve
> --
> Steve Holden       +44 150 684 7255  +1 800 494 3119
> Holden Web LLC/Ltd          http://www.holdenweb.com
> Skype: holdenweb     http://del.icio.us/steve.holden
> Blog of Note:          http://holdenweb.blogspot.com




More information about the Python-list mailing list