LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   tar and symlinks? (https://www.linuxquestions.org/questions/linux-general-1/tar-and-symlinks-471511/)

neocookie 08-07-2006 03:38 AM

tar and symlinks?
 
Hi all

I'm trying to create a tar backup of some directories. They've got symlinks in them, however, to directories I don't need to backup. Can I tell tar to skip these linked directories when creating the backup?

Thanks.

druuna 08-07-2006 04:52 AM

Hi,

Tar does not have an exclude symlinks option, you need to be creative. An example:

tar cf - `find . ! -type l` > tst.tar

The find command gets all files (current dir and above), except links (! -type l), all files found are given to tar and put in tst.tar.

Hope this helps.

timmeke 08-07-2006 05:08 AM

If they are symlinks to other filesystems, then maybe you could use tar's -l option?
Tar also supports adding exclusion patterns, if that helps.

If those don't help, use druuna's technique (ie give a list of files - without the symlinks - to tar), either via stdin or via a file and the --files-from option.


All times are GMT -5. The time now is 03:52 AM.