anonymous
anonymous

Reputation: 31

Unzipping file without first directory

I want to extract some files. Ex. test.zip to /path/to/folder. Using Archive::Extract and specifying a "to" in extract I can extract it to /path/to/folder, but it extracts to /path/to/folder/test. Same goes for using the system unzip/gunzip.

I don't want to unzip -j, I want to keep the subdirectories.

Is there a way to do this that does not involve browsing to /path/to/folder/test and cp -rf * ../? Either by system command or in perl...

Thanks for reading. :)

Upvotes: 2

Views: 1566

Answers (1)

Axeman
Axeman

Reputation: 29854

You might prefer Archive::Zip

Archive::Zip->new( 'test.zip' )->extractTree( '', '/path/to/folder' );

Upvotes: 3

Related Questions