I am working on a project in python in which I need to extract only the subfolder of the tar archive of not all files. I tried to use
tar = tarfile.open(tarfile) tar.extract("dirname", targetdir)
But this does not work, it does not extract the given subdirectory, and the exception is not thrown. I am new to python. Also, if the above function does not work for directories, then what is the difference between this command and tar.extractfile ()?
source share