SSH Zip folders and files

Kaz Wolfe

Well-known member
Registered
Joined
Jul 7, 2016
Messages
604
Points
28
I want to zip all folders and files in entire folder, how can i use zip command to do this task? Thanks for any help!
 

LJSHost

Well-known member
Hosting Provider
Registered
Joined
Jul 5, 2016
Messages
1,031
Points
63
Hi Kaz

Few different ways you can do this, but this example keeps things simple:

Code:
zip -r myfiles.zip /home/mydir/
This will zip everything from /home/mydir/ and above into myfiles.zip
 

fwh

Administrator
Staff Member
Joined
Dec 8, 2012
Messages
773
Points
63
Hi Kaz

Few different ways you can do this, but this example keeps things simple:

Code:
zip -r myfiles.zip /home/mydir/
This will zip everything from /home/mydir/ and above into myfiles.zip
You can also try this below tar command to compress your files :

tar -czvf filename.tar.gz /folder/
Are you sure it will zip everything in mydir/folder?

I zipped public_html folder of my websites and it missed .htaccess file

I had to use this code to zip all files/folders in a folder inclduing .htaccess file.

Code:
zip -r myfilename.zip * .htaccess
Check yours if i can include .htaccess file :D
 

Vishnu

Active member
Registered
Joined
Jan 3, 2017
Messages
77
Points
8

bknights

Well-known member
Registered
Joined
Jun 23, 2016
Messages
97
Points
8
bknights
It is inconvenient to add files after had a zip file. I am wondering why .htaccess file could not be added into zip file. It is a special file or hidden file?
If so, there are other files need to add manually into the command above.
 

Latest Hosting OffersNew Reviews

Sponsors

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top