SHARE
TWEET
extract tar file on windodws (uft8 and colon in filenames)
a guest
Aug 13th, 2015
236
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- import tarfile
- archive_name = "backup_home.tar"
- tar = tarfile.open(name=archive_name, mode='r', bufsize=16*1024)
- intab = ":"
- outtab = "_"
- for m in tar.getmembers():
- # : zu _ abändern
- m.name = m.name.translate({ord(x): y for (x, y) in zip(intab, outtab)})
- tar.extractall('D:\\Backup')
- tar.close()
RAW Paste Data
