I am writing a program in python and using tarfile to extract tarfiles. Some of these tarfiles contain folders which start with a / or (Alternatively for windows \) which cause problems (files are extracted to wrong place). How can I get around this issue and make sure that the extraction ends up in correct place ?
I am writing a program in python and using tarfile to extract tarfiles. Some
Share
The docs for
tarfileexplicitly warn about such a scenario. Instead you need to iterate over the content of the tar file andextracteach file individually: