tar version
####################################################
tar (GNU tar) 1.34
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by John Gilmore and Jay Fenlason.
####################################################
I'm passing on this solution to help others avoid my frustration and
wasted time. If you've done "RTFM" on tar, you'll find out that "TFM"
is broken or out-of-date or whatever, re: "--exclude=PATTERN". I'm
fighting the urge to turn this into a rant. Here's my situation...
I either log in as root or "su -" and then "cd /home". I want to tar
up /home/waltdnes, and transfer it to another machine. While I'm at it,
I want to exlude directory /home/waltdnes/.cache/ and all *.xz files in
directory /home/waltdnes/pm/ The "--exclude=" never worked. After much
hair pulling, I was ready to give up on the exclude, and simply transfer
all the unnecessary garbage.
Then "I asked Mr. Google". It seems that I wasn't the only person
running into problems. After some searching, I finally found a syntax
that works...
####################################################
#!/bin/bash
export GZIP=-9
tar cvzf wd.tgz --exclude ".cache/*" --exclude "pm/*.xz" waltdnes
####################################################
Notes...
1) This is obviously not in line with the man page. Specifically,
"--exclude" is followed by one space, not an equals sign.
2) ***THERE MUST BE EXACTLY ONE SPACE BETWEEN EACH WORD***
3) All directories and/or files to exclude must be listed as relative
paths to the directory being tarred, i.e. last parameter on the command
line.
4) I don't know the maximum line-length, which would limit the number of
--exclude entries. In those cases, I wonder if "--exclude-from=FILE"
works as "--exclude-from FILE".
--
Walter Dnes <waltdnes@waltdnes.org>
I don't run "desktop environments"; I run useful applications
####################################################
tar (GNU tar) 1.34
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by John Gilmore and Jay Fenlason.
####################################################
I'm passing on this solution to help others avoid my frustration and
wasted time. If you've done "RTFM" on tar, you'll find out that "TFM"
is broken or out-of-date or whatever, re: "--exclude=PATTERN". I'm
fighting the urge to turn this into a rant. Here's my situation...
I either log in as root or "su -" and then "cd /home". I want to tar
up /home/waltdnes, and transfer it to another machine. While I'm at it,
I want to exlude directory /home/waltdnes/.cache/ and all *.xz files in
directory /home/waltdnes/pm/ The "--exclude=" never worked. After much
hair pulling, I was ready to give up on the exclude, and simply transfer
all the unnecessary garbage.
Then "I asked Mr. Google". It seems that I wasn't the only person
running into problems. After some searching, I finally found a syntax
that works...
####################################################
#!/bin/bash
export GZIP=-9
tar cvzf wd.tgz --exclude ".cache/*" --exclude "pm/*.xz" waltdnes
####################################################
Notes...
1) This is obviously not in line with the man page. Specifically,
"--exclude" is followed by one space, not an equals sign.
2) ***THERE MUST BE EXACTLY ONE SPACE BETWEEN EACH WORD***
3) All directories and/or files to exclude must be listed as relative
paths to the directory being tarred, i.e. last parameter on the command
line.
4) I don't know the maximum line-length, which would limit the number of
--exclude entries. In those cases, I wonder if "--exclude-from=FILE"
works as "--exclude-from FILE".
--
Walter Dnes <waltdnes@waltdnes.org>
I don't run "desktop environments"; I run useful applications