<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def __get_nfiles_to_compress(self):
 """ Return the number of files to compress Note: it should take about 0.1s for counting 100k files on a dual core machine """

        floyd_logger.info("Get number of files to compress... (this could take a few seconds)")
        paths = [self.source_dir]
        try:
            # Traverse each subdirs of source_dir and count files/dirs
            while paths:
                path = paths.pop()
                for item in scandir(path):
                    if item.is_dir():
                        paths.append(item.path)
                        self.__files_to_compress += 1
                    elif item.is_file():
                        self.__files_to_compress += 1
        except OSError as e:
            # OSError: [Errno 13] Permission denied
            if e.errno == errno.EACCES:
                self.source_dir = os.getcwd() if self.source_dir == '.' else self.source_dir  # Expand cwd
                sys.exit(("Permission denied. Make sure to have read permission "
                          "for all the files and directories in the path: %s")
                         % (self.source_dir))
        floyd_logger.info("Compressing %d files", self.__files_to_compress)