7zip CLI: specify target filename on extract

6.7k Views Asked by At

I'm trying in the last 4 hours to do something that sounds simple :) Can I (any how) set the target file in the 7za command? (I need to rename the target filename, and add .bak to its extension)

Here is the command right now:

7za e -bd -y -o"target_folder" "source_folder" "filename"

so, same filename will be on target here.

Thank you.

2

There are 2 best solutions below

3
On

Try this:

7za e "source.zip" -o"target_folder"

Please note 'target_folder' could contain the folder name you want. And seems you switched 'Source' and 'Target'

For example:

7za e 123.zip -oc:\456

And for now, as far as I know, there is no way to modify each filename in the target folder. Folder name only.

0
On

if you are certain there is only one file in the archive, you can do the following:

7za e "c:\data\compressed_file.gz" -so > "c:\data\destination_file_name.txt.bak"

I have not attempted working with an archive with multiple files.