Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

 Compress, Exclude folder

views
     
TSUbuntuClient
post Oct 12 2021, 07:30 PM, updated 3y ago

Regular
******
Senior Member
1,349 posts

Joined: Jun 2007
From: /puchong/cyberjaya/klang



Hi,

I try to compress and exclude folder uploads. Seems to exclude not working or i miss something.

Using code below ( under /home/user)
CODE
tar -cvzf nama.tar.gz public_html/ --exclude='/home/myuser/public_html/wp-content/uploads/'


Please advise.

Thanks.

TSUbuntuClient
post Oct 12 2021, 07:40 PM

Regular
******
Senior Member
1,349 posts

Joined: Jun 2007
From: /puchong/cyberjaya/klang



Using this also still include the uploads folder.
CODE
tar -cvzf nama.tar.gz --exclude='/home/myuser/public_html/wp-content/uploads' public_html/

TSUbuntuClient
post Oct 12 2021, 07:44 PM

Regular
******
Senior Member
1,349 posts

Joined: Jun 2007
From: /puchong/cyberjaya/klang



Not all tutorial in internet is correct. Sometimes the writer writing without test. Now getting correct command line.
CODE
tar -cvzf nama.tar.gz --exclude wp-content/uploads public_html


p/s: Don't believe what you see
FlierMate
post Oct 12 2021, 07:57 PM

On my way
****
Validating
543 posts

Joined: Nov 2020
I tried this and it works:

CODE
$ tar -cvzf nama.tar.gz --exclude="public_html/wp-content/uploads" public_html

angch
post Oct 12 2021, 08:43 PM

On my way
****
Junior Member
635 posts

Joined: Jul 2006
If you have the hardware to support it, (and the data size big enough) zstd is worth it.
CODE
time tar cvf - --exclude="public_html/wp-content/uploads" public_html | zstd -19 -T24 > nama.tar.zst


CODE
$ time tar cf - go | zstd -19 --long -T24 > go.tar.zst

real    1m7.072s
user    19m49.057s
sys     0m4.560s
$ time tar czf go.tar.gz go

real    1m11.312s
user    1m10.819s
sys     0m2.665s
$ time tar cf - go | xz -9 -e > go.tar.xz

real    18m5.242s
user    18m4.260s
sys     0m9.174s
$ du -sh go go.tar.gz go.tar.zst go.tar.xz
3.2G    go
1.1G    go.tar.gz
584M    go.tar.zst
573M    go.tar.xz


Faster (wall clock), and better compression.
xz is smaller, but takes 18x the time.

This post has been edited by angch: Oct 12 2021, 09:58 PM

 

Change to:
| Lo-Fi Version
0.0125sec    0.31    5 queries    GZIP Disabled
Time is now: 29th March 2024 - 07:39 PM