Pergunta

I'm using the python UnRar2 file to unrar a file, but after I do so I want the name of the directory it is unrared to. Is it possible to use the Unrar2 lib to get that information and if so can you please show me how to?

Thanks,

Parth

EDIT: Sorry, what I mean is when you extract a rar, it creates a folder with the contents of the rar (in my case, this is always true). I want to know how to obtain the name of that folder.

Foi útil?

Solução

I think you might be calling this function extract(self, condition='*', path='.', withSubpath=True, overwrite=True) to extract the content of a rar file.

From the documentation of python rarfile moduleSee the extract method.

I came to know that its extract method extract the content to the current working directory unless path variable is set explicitly.

So, I believe this should be the case for unrar too. Anyways you can always set the path where you want to extract the content too.

It is mentioned in unrar's documentation that path signifies:

"path" is a directory to extract to

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top