How to zip a folder with SSH

Posted on: August 5th, 2022
By: Tadeo Martinez

How to zip a folder with SSH

Here’s how to not include /node_modules/

zip -r file.zip folder -x "**/node_modules/*"
zip -r wp-content.zip wp-content -x "**/node_modules/*"

Below is just to zip a folder

zip -r file.zip folder

To delete all the /node_modules/ folders or directories in case you did upload, here’s how

find . -type d -name "node_modules" -exec rm -rf {} +

The one below is if the /node_modules/ is immediately inside the folder.
zip -r my-archive.zip my-folder -x "my-folder/node_modules/*"

How to unzip a folder with SSH

unzip foldername

How to zip all files and folders inside a folder

zip -r backUp.zip *

How to remove folder and all its contents with SSH

rm -rf FOLDERNAME

How to unzip a folder

unzip foldername

Have any questions or comments? Write them below!


Leave a Reply

Your email address will not be published. Required fields are marked *