Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Finding Duplicate File Namesin Many Folders

Name: Anonymous 2009-01-19 18:45

Recently, a bug was found in the software my employer makes in which the same record number was issued to two or more clients, so that there would be different records with the same number on more than one client.

The bug was fixed, but we wanted to find out if any of our customers had been affected by this bug. A normal directory compare wouldn't work, because all the software we found could only compare between two folders; however, we need to compare the folders of multiple clients to see if any of them share file names with any others, which would be an indication that the bug had occurred.

So, I came up with an algorithm and wrote the code to do just that. The C# program I wrote can find 200,000+ duplicated records in 60+ network folders in about two minutes.

Challenge: come up with an algorithm that, given multiple folders, gives a list of file names shared between two or more folders, and for each duplicated file name found, a list of folders in which it is found.

Example:

Folders:

Folder1\
        1.txt
        2.txt
        3.txt
Folder2\
        3.txt
        9.txt
        100.txt
Folder3\
        2.txt
        9.txt
        55.txt


Results:

2.txt
      Folder1
      Folder3
3.txt
      Folder1
      Folder2
9.txt
      Folder2
      Folder3

Name: Anonymous 2009-01-19 20:06

>>5
I don't think you thought your approach through, buddy, because it is, y'know, stupid as fuck. What you should do is create a dictionary using the filenames as keys and lists of directories as values.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List