How to use custom command to zip a folder?

Advertisement

Akari
Guest

How to use custom command to zip a folder?

I know how to zip a file with
zip -r "!?&File(&A):?archive.zip!" !&
and i know how to zip a folder with
zip -r "!?File(&A):?archive.zip!" !& "!?Folder(&A):?folder name!" !&
But is there a way to zip a select folder without typing any archive name or folder name?
e.g if i selected folder name abc once i rune the command it will create a zip file name abc.zip

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
27,226
Location:
Prague, Czechia

Re: How to use custom command to zip a folder?

I do not understand your "ZIP folder" command. It seems wrong.

Anyway to ZIP selected folder, use zip -r "!.zip" "!". This way you cannot pack more folders into one archive.

Reply with quote

Akari
Guest

Re: How to use custom command to zip a folder?

Not working for me,
Is there anything require by the server?
But i tried
 zip -r "a!.zip" "!/"    
in folder /WWW/abc/
and i selected 123 folder, the output is zip the /WWW/abc/ in a.zip file.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,226
Location:
Prague, Czechia

Re: How to use custom command to zip a folder?

Akari wrote:

Not working for me
That's not very helpful statement. What does it do? Any error message?
Did you check the Apply to directories option?
_________________
Martin Prikryl

Reply with quote

Akari
Guest

Thank you,prikryl!

I just notice i din't check the box "Apply to directories",
after check it, the command is working!! That y alot of command dint run for me..
Sorry my bad english, and thank for your patient to solve my problem. You help me alot, thank again!

Reply with quote

higgins
Joined:
Posts:
2

The gzip command won't recursively clamp a catalog into a solitary compress record, when utilizing the -r switch. Rather it will walk that registry structure and compress each one document that it finds into a different record.

Reply with quote

MGM
Guest

Re: How to use custom command to zip a folder?

martin wrote:

I do not understand your "ZIP folder" command. It seems wrong.

Anyway to ZIP selected folder, use zip -r "!.zip" "!". This way you cannot pack more folders into one archive.

How to add timestamp to zip archive?

Like: folder ==> zip into ==> folder-timestamp.zip

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,226
Location:
Prague, Czechia

Re: How to use custom command to zip a folder?

zip -r "!-`date +%Y%m%d%H%M`.zip" "!/"

Reply with quote

wasimxe
Joined:
Posts:
2
Location:
pakistan

Could be this done?

your zip command with specific path and same name as directory is working fine but could be done via prompt box,

I am trying this

zip -r "!?&Enter an Archive Name:?/backup/archive.zip!" !&

I want to replace "archive" here with same name as directory which I am going to create zip.

Thanks

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,226
Location:
Prague, Czechia

Re: Could be this done?

wasimxe wrote:

your zip command with specific path and same name as directory is working fine but could be done via prompt box,

I am trying this

zip -r "!?&Enter an Archive Name:?/backup/archive.zip!" !&

I want to replace "archive" here with same name as directory which I am going to create zip.

Thanks
Your duplicate post:
https://winscp.net/forum/viewtopic.php?p=79170#79170
_________________
Martin Prikryl

Reply with quote

Advertisement

You can post new topics in this forum