The method has this documentation:
# Algorithm:
      # assume that current dir is present
      # ls (glob) the dir path for child dirs and files
      # if child file is not already present, add it as new, mark it and handle its state
      # if file already present, mark it and handle its state.
      # if child dir is not already present, add it as new, mark it and propagates
      #    the recursive call
      # if child dir already present, mark it and handle its state
      # marked files will not be remove in next remove phase

We could exmplain better the pseudo algorithm there..