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
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
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
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
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: