Reputation: 13
I encountered an issue when I tar a directory. There is a backup file in one of the sub directory created by another user and it doesn't allow other user to read. so my tar command was failed.
My question is: Can I ignore this file (actually this file is not important) and tar the rest of the files/directories?
Upvotes: 1
Views: 5381
Reputation: 57002
From Gnu tar manual:
To avoid operating on files whose names match a particular pattern, use the
--exclude
or--exclude-from
options.
--exclude=pattern
Causes tar to ignore files that match the pattern.
so you can use
tar --exclude='your_file_to_exclude'
Upvotes: 2
Reputation: 61
You can globally ignore read failures with some tar distros.
--ignore-failed-read
Do not exit with nonzero on unreadable files.
Upvotes: 4