Re: Matching Directory Names and Grouping Them

2007-01-12 Thread Neil Cerutti
On 2007-01-11, J [EMAIL PROTECTED] wrote: 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

Matching Directory Names and Grouping Them

2007-01-11 Thread J
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

Re: Matching Directory Names and Grouping Them

2007-01-11 Thread Steve Holden
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

Re: Matching Directory Names and Grouping Them

2007-01-11 Thread J
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

Re: Matching Directory Names and Grouping Them

2007-01-11 Thread Virgil Dupras
From your example, if you want to group every path that has the same last 9 characters, a simple solution could be something like: groups = {} for path in paths: group = groups.setdefault(path[-9:],[]) group.append(path) I didn't actually test it, there ight be syntax errors. J wrote: