Using Zipfile in Python 3.6, I am able to successfully extract a zip using:
with zipfile.ZipFile(my_zip,"r") as zip_ref:
zip_ref.extractall('./download')
The zip will always contain one top level folder:
- with a unique ID filename that is different to the original ZIP filename
- Ends with .gdb
- Has other folders and files within it.
I need to return the name of the top level extracted folder, highlighted above.
zip_ref.namelist() and zip_ref.filelist = Returns all the files under the root folder that was extracted.
I can see a way of doing this using replace on one of the paths of the files in the underlying folder, but feels like the wrong approach.
Can someone point me in the right direction please?