开发者

Unzipping file without first directory

开发者 https://www.devze.com 2023-03-22 23:47 出处:网络
I want to extract some files. Ex. test.zip to /path/to/folder. Using Archive::Extract and specifying a \"to\" in开发者_如何学Go extract I can extract it to /path/to/folder, but it extracts to /path/to

I want to extract some files. Ex. test.zip to /path/to/folder. Using Archive::Extract and specifying a "to" in开发者_如何学Go 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. :)


You might prefer Archive::Zip

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

精彩评论

暂无评论...
验证码 换一张
取 消