Skip to content

Linux tar command ignore files which permission denied

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?



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’

User contributions licensed under: CC BY-SA
4 People found this is helpful