Ejemplo n.º 1
0
    def findDuplicates(self):
        detls = self.getDetails()
        work = filter(lambda x: x.isFile, detls)

        # set up the size dict with blank lists
        sizes = []
        for elt in detls:
            sizes.append(elt.size)
        lists.uniqueSort(sizes)

        sdict = {}
        for size in sizes:
            sdict[size] = []

        for elt in detls:
            sdict[elt.size].append(elt)

        # now, use the two dicts to find all entries
        # with more than one item in the list
        work = sdict.values() # + fdict.values()
        work = filter(lambda x: len(x)>1, work)

        dupeList = []

        for dl in work:
            test_dupes(dl, dupeList)

        return dupeList
Ejemplo n.º 2
0
    def getFilenames(self):
        '''returns the tree filenames without paths, sorted uniquely'''
        if not self.__filenames_cached:
            files = self.getFiles()
            trimFunc = lambda x: os.path.basename(x)
            filenames = map(trimFunc, files)
            lists.uniqueSort(filenames)
            self.__filenames = filenames
            self.__filename_cached = 1

        return self.__filenames