This is the main method of the class. Given the arguments,
        the corresponding list of all files (or directories if the -d option is used)
        are returned.

def getFiles(self,args):
        """
        This is the main method of the class. Given the arguments,
        the corresponding list of all files (or directories if the -d option is used)
        are returned.
        """
        fileList = []
        if args.recursive:    # The list is created by going through the folder(s) recursively:
            fileList = self.createListRecursively(args)
        else:    # The list is created by going through the provided folder(s):
            fileList = self.createList(args)
        if args.directories:
            # If directories are returned, the list is sorted in reverse order.
            # This allows the processing of subfolders before the processing of the parent folder.
            # Processing the parent folder first may not work because the command may remove
            # or rename the folder, which would affect the subfolders.
            fileList = [element for element in fileList if os.path.isdir(element)]
            return sorted(fileList,reverse=True)
        else:
            # Filter out all directories:
            fileList = [element for element in fileList if os.path.isfile(element)]
	    if args.extensions != None:    # Files are filtered based on their extensions:
                extensionList = self.getExtensionList(args.extensions)
                fileList = [element for element in fileList if os.path.splitext(element)[1] in extensionList]
            # The files in the list are sorted in lexicographical order:
            return sorted(fileList)