Title: tar: Remove leading / from member names when using -X (exclude file)
Tags: bash;tar
Question: I am getting the error:
Remove leading / from member names
when attempting to create a domain archive using -X and a exclude file. If I remove the -X option the job executes as expected.
backup exec
/mnt/15326/s3/backup.sh
tmp dir
/mnt/15326/s3/data
exclude file
/mnt/15326/s3/data/exclude.txt
with contents
/mnt/15326/www.domain.com/dir1
/mnt/15326/www.domain.com/dir2
dir to backup
/mnt/15326/www.domain.com
command to run
tar cf /mnt/15326/s3/data/backup_domain.com -X /mnt/15326/s3/data/exclude.txt /mnt/15326/www.domain.com

Here is the accepted answer: It is a warning only. It means that in the tar file the file names wont contain the beginning /. They will be converted to relatives. Use -P if it disturbs you. generaly this default behaviour is a bit safer.
Comment for this answer: It's not that it disturbs me, it's not excluding the directory. I assumed the warning had something to do with it.
Comment for this answer: The exclude file should contain exclude patterns.Put a * after the dir names.


{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2013:00:09/28/13', 'FavoriteCount': 1.0, 'PostTypeId': 1, 'Tags': '<bash><tar>', 'Title': 'tar: Remove leading / from member names when using -X (exclude file)', 'ViewCount': 10442, 'id': 19072345, 'user_AboutMe': '', 'user_AccountId': 1110772.0, 'user_DisplayName': 'chrisrth', 'user_Reputation': 1152.0, 'user_Views': 76.0, 'user_id': 1101267.0}}