We help IT Professionals succeed at work.

Zip command line program

High Priority
75 Views
Last Modified: 2020-03-05
I would like to use a script to effectively copy data from one computer to a server, create a zip file, and password protected.
What would you suggest?
Comment
Watch Question

NVITEnd-user support
CERTIFIED EXPERT

Commented:
7-Zip is free and has command line options, including password
ZvonkoSystems architect
CERTIFIED EXPERT
Top Expert 2006

Commented:
I would suggest to create the Zip on the computer and copy only the Zip to server.
ZvonkoSystems architect
CERTIFIED EXPERT
Top Expert 2006

Commented:
Copying single files over network needs extra step to check whether one single file failed to be copied.
Also the one big block is better and faster copied then multiple small files.

Bill PrewTest your restores, not your backups...
CERTIFIED EXPERT
Expert of the Year 2019
Top Expert 2016

Commented:
7-Zip is definitely the best free tool for this.  There are lots of examples here on Experts Exchange showing how to use it in scripting situations, mostly BAT, but some VBS and PS1 too.

As mentioned compressing on the client will reduce the size of the data that you have to send to the server and perhaps speed up the process.  Although naturally creating the ZIP file take some time too on the client to do the compression.

Is this just for backup purposes, or will you be unzipping it as soon as it gets oto the server?


»bp
Michael B. SmithManaging Consultant
CERTIFIED EXPERT

Commented:
Compress-Archive is the built-in PowerShell cmdlet for this need. PS v3 and above, no third-party install required.
Principal Software Engineer
CERTIFIED EXPERT
Commented:
Per NVIT supra, if archive size is an issue ... 7-zip, gzip and bzip2 are command line programs which can compress significantly better than zip.
Lee W, MVPTechnology and Business Process Advisor
CERTIFIED EXPERT
Most Valuable Expert 2013

Commented:
Echo echo echo...

I recommend 7ZIP instead - it's free and open source.  Examples can be found here: https://www.dotnetperls.com/7-zip-examples
Bill PrewTest your restores, not your backups...
CERTIFIED EXPERT
Expert of the Year 2019
Top Expert 2016

Commented:
Need more details:
  • Detailed info about files to be zipped, all in one folders or several? subfolders? selected extensions or all?
  • What zip utility do you want to use?
  • Where will file be placed?
  • Will password be in the BAT file, hard coded?
  • Should the zip, or files be deleted afterwards?
  • . . .


»bp