I am trying to tar the contents of a directory using the tarfile module.
Say this directory, called 'A', has several subdirectories, 'a' and 'a1' etc... Is there a way to exclude these directories from the tarfile object when trying to add? For example, I have a list of files to exclude, which I put in the list:
EXCLUDE_FILES = ['README', '.gitignore']
I can exclude these following a solution found here. However, can this method be altered to exclude directories or is there another way in which it can be done?