DEV Community

Ngobrolin IT
Ngobrolin IT

Posted on • Edited on

How to Create Zip Your Code From Visual Studio Code

Hello, dev.. πŸ‘‹

In this tutorial, I will share about how to create a zip file of your code directly from Visual Studio Code without an addon. We need a terminal to execute our command line.

For example, we want to zip the mahal folder, so we open the terminal from the themes folder. Right-click on the themes folder and select "Open in Integrated Terminal".

Integrated Terminal on VS Code

After your terminal command line is open, you can execute this command

zip -r mahal.zip mahal -x '*.git*'
Enter fullscreen mode Exit fullscreen mode

Explanation:

  • mahal.zip is the name of the zipped file. You can change with your need.
  • -r means to zip a directory recursively. This option helps you to zip all the files present in the specified directory.
  • -x means exclude the files in creating the zip. For example, we exclude the .git folder from zipping.

Good luck 🍻

Top comments (3)

Collapse
 
john_knight profile image
John Knight

Sorry, this does not work. 'zip' is not natively available in VS Code and results in:

zip : The term 'zip' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct
and try again.

I'll post back here if I find how to fix this.

Collapse
 
ngobrolinit profile image
Ngobrolin IT

Hey bro, the "zip" command is natively available in Mac OS. If you are a Mac user, this tutorial should work for you.

Collapse
 
john_knight profile image
John Knight

Ah, thanks for clarifying that ☺️

I was using Windows at the time, appreciate you replying πŸ‘