--"Dege, Robert C." <robert.dege@xxxxxxx> wrote:
Tar will only exclude patterns that match the list in the archive it's creating. So first, you need to drop the '/', since tar automatically drops that. So your tar line should look like this: # tar -cvf /backup.tar --exclude=home/tempuser/work /home/tempuser
Not true ;-) ... It's not important whether you have the '/' or not. But you must precede every 'exclude' with the '--exclude' flag. You can't list them like you did. At leas in GNU tar. Try this (tar-1.14-4): The presence of the toplevel '/' has no effect: # cd /tmp # tar czf etc1.tgz /etc --exclude etc/sysconfig # tar czf etc2.tgz /etc --exclude /etc/sysconfig # tar czf etc3.tgz /etc # tar tzf etc1.tgz | grep sysconfig etc/X11/sysconfig/ etc/X11/starthere/sysconfig.desktop # tar tzf etc2.tgz | grep sysconfig etc/X11/sysconfig/ etc/X11/starthere/sysconfig.desktop # tar tzf etc3.tgz | grep sysconfig etc/sysconfig/ etc/sysconfig/console/ etc/sysconfig/system-logviewer etc/sysconfig/ntpd ........ However: # tar czf etc4.tgz /etc --exclude etc/sysconfig etc/ntp tar: Removing leading `/' from member names tar: etc/ntp: Cannot stat: No such file or directory tar: Error exit delayed from previous errors You must do # tar czf etc4.tgz /etc --exclude etc/sysconfig --exclude etc/ntp Interestingly, I put the files-to-backup before the '--exclude', you put them after, which is the way to do it according to the man page. Interesting. -- redhat-list mailing list unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe https://www.redhat.com/mailman/listinfo/redhat-list