def get_stats(self):
        """
        Calculate directory size and number of days since last update.
        """
        dirs_queue = queue.Queue()
        dirs_queue.put(self.path)

        while not dirs_queue.empty():

            try:

                path = dirs_queue.get()
                entities = os.listdir(path)

            except OSError as os_error:
                self._log_skipped(os_error)
                continue

            for entity in entities:
                fullpath = os.path.join(path, entity)

                try:

                    mode = os.stat(fullpath).st_mode

                    if S_ISDIR(mode):

                        self.subdirs += 1
                        dirs_queue.put(fullpath)

                    elif S_ISREG(mode):

                        self.files += 1
                        self.size += os.stat(fullpath).st_blocks * BLOCK
                        self.allocated += os.stat(fullpath).st_size
                        last_modified = os.stat(fullpath).st_mtime
                        if last_modified > self.modified:
                            self.modified = last_modified

                except OSError as os_error:
                    self._log_skipped(os_error)
                    continue

        if not self.skipped and not self.modified:
            self.modified = os.stat(self.path).st_mtime

        Calculate directory size and number of days since last update.
        
src/collectors/dirstats/dirstats.py