Create a zip file using command line




















Forgot to add some files while creating a ZIP archive? No worries, you can add files to an existing archive without any hassle. Simply select the files you want to include in your archive, click an option, and your ZIP archive is ready. Even when you don't need to compress files, ZIP archives are still handy.

We'll show you how to make them on macOS. Mahesh is a tech writer at MakeUseOf. He's been writing tech how-to guides for about 8 years now and has covered many topics. He loves to teach people how they can get the most out of their devices. Share Share Tweet Email. I am using windows Xp can u suggest? Without adding the path, by calling the. Shrikant Verma Shrikant Verma 1 1 silver badge 3 3 bronze badges.

This syntax doesn't work if you're trying to zip more than one item. The microsoft reference for the cmdlet: docs. Still it will work, that all you have to do is, just go to parent folder and try to zip entire folder so automatically all the items inside the folder will automatically zip, Hope it help Compress-Archive relies upon the Microsoft. You can use the following command: zip -r nameoffile.

MitulP91 MitulP91 1, 1 1 gold badge 11 11 silver badges 24 24 bronze badges. The command zip is not recognized as internal or external command. Can you suggest me in windows XP? This will not be platform independent. I think OP wants to do it using java. The zip Package should be installed in system. ELinuxbook ELinuxbook 95 2 2 bronze badges. I assume that works on Linux, but it doesn't work on Windows.

Of course, the OP didn't mention which operating system he was using. Michal Sipek Michal Sipek 6 6 silver badges 17 17 bronze badges. Improve this answer. Zombo Zombo 9, 20 20 gold badges silver badges bronze badges. The second option didn't work for me on 17G dump file. But [IO. ZipFile]::CreateFromDirectory did. Note to newbies like me - with tar. Free apps still can though, — EvilDr. StevenPenny it's acceptable if you want it to work like tar works. That wasn't what I set out to do, but it will work for me now.

That's a handy trick to know. It won't copy empty folders so be careful. OpenTextFile target, 2, vbtrue ' this is the header to designate a file as a zip zip.

NameSpace source. Items If objItem. GetFolder objItem. Path ' if this folder is empty, then skip it as it can't compress empty folders If objFolder.

NameSpace target. Count wscript. WSkid WSkid 4 4 bronze badges. Looks promising, but I got an "Object required: 'objApp. I have the same problem. The above code doesn't work, or needs some extra stuff in the system the poster forgot to mention. It uses WScript vbs environment and several Shell objects. All were installed by default in Windows XP business?

Perhaps they are longer there for Win8? But what would be the advantage to this approach? Why not just write the PowerShell script to a fixed file and let it accept parameters? I tried all the other solutions. The most important advantage is use of powershell's native commands and no need to create the old-tech VBScript. This worked for me on an old corporate windows7 laptop in Can be run direct from CMD, no need to create.

Here is a great link that shows how to zip a file using windows native commands. Community Bot 1. LostUser LostUser 27 2 2 bronze badges.

You should include the instructions in your answer. If the links go stale, your answer will be worthless



0コメント

  • 1000 / 1000