Compress all by SSH except a folder in Centos7

3

I would like to compress everything in zip , that is all content of my public_html but I need the files folder not added for compression.

    
asked by anonymous 29.05.2018 / 07:00

1 answer

3

For a " one line command " you will need to know the full path of all directories you do not want to include in the zip.

Sample structure:

pasta1
    a.txt
    b.txt
    pasta2
        c.txt
        d.txt
    pasta3
        e.txt
        f.txt
    pasta4
        g.txt
        h.txt

In the following command, I am directing not to compact the folders pasta2 and pasta3 :

zip -r novoZip.zip pasta1 -x pasta1/pasta2/\* pasta1/pasta3/\*

My file novoZip.zip looks like this:

pasta1
    a.txt
    b.txt
    pasta4
        g.txt
        h.txt
    
29.05.2018 / 14:05