Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi,
Please shed some light on the --exclude and/or --exclude option within tar. I've searched the forums and followed all the advices. using full path of directories and also tried using a file to include all the exclusions, yet it still includes the unwanteds. Thank You
Code:
tar cvzf ${backupdir}/jira-home.${today}.tgz $origdirname --exclude-from /opt/jira/files_to_exclude_from_backup
--exclude tar czf name_tar_file.tar --exclude='insert_pattern' target/
--exclude-from tar czf name_tar_file.tar --exclude-from='insert_file_name' target/
The patterns in the exclude file and the target should both be full path or relative.
The tar command posted in post #1 would look like this when using --exclude-from:
Code:
tar cvzf ${backupdir}/jira-home.${today}.tgz --exclude-from='/opt/jira/files_to_exclude_from_backup' $origdirname
If that doesn't work you might want to look at $origdirname, it should expand to a full path (which you also used in your exclude file).
Hope this helps.
Last edited by druuna; 12-09-2010 at 02:25 AM.
Reason: spelling
stress_junkie,
that did it. any comments as to why it doesn't like the full path?
I wish I knew.
It may have something to do with the way tar strips off the leading path elements to the source directory. I always change my working directory to / before I run tar. The tar utility strips off the / part of the path when it creates the file names in the archive file. We all knew that, but maybe this exclude thing is related to that.
Last edited by stress_junkie; 12-08-2010 at 03:21 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.