문제

I'm using pyUnrar2 to batch extract rar files, what I would like to acquire is the name of the directory that the files reside in once extracted ?

도움이 되었습니까?

해결책

Extract path is set as an argument to extract().

If an archive have its own parent directory, you can grab it by using infolist():

import UnRAR2

rarc = UnRAR2.RarFile('test.rar')
list = rarc.infolist()

if list[0].isdir:
    print 'Parent directory in archive: %r' % list[0].filename
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top