Avatar of Tek Info
Tek Info
 asked on

Zip command line program

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?
PowershellWindows Batch* zipped filesScripting Languages

Avatar of undefined
Last Comment
Bill Prew

8/22/2022 - Mon

7-Zip is free and has command line options, including password

I would suggest to create the Zip on the computer and copy only the Zip to server.

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.

This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
Bill Prew

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?

Michael B. Smith

Compress-Archive is the built-in PowerShell cmdlet for this need. PS v3 and above, no third-party install required.
Dr. Klahn

View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Lee W, MVP

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
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Bill Prew

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?
  • . . .