Unix questions - gnu tar delete w/exclude

This is Interesting: Free IT Magazines  
Home > Archive > Unix questions > November 2005 > gnu tar delete w/exclude





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author gnu tar delete w/exclude
RR

2005-11-23, 7:51 am

I have a tared ziped archive and I want to --delete
all files --exclude'ing a few that I want to keep
within the archive.

I wanted to use the --delete with gnu tar for
efficiency, I know I can untar the whole thing to disk
and tar back up what I want, but its taking too
much time to go through all of them at night.

I tried using --delete '*' --exclude 'log', but
it almost looks like the --exclude does not apply to
--delete command.

are there a gnu tar arguments that would let
me delete everyting except for a list of critical files.

so for example my file (t.tgz) has these files

call/log
call/data/file1
call/data/file2
call/tmp/file3

I want to keep log and data/*
I tried using gnu tar 1.15.1
cat t.tgz | gunzip |
tar -f - --exclude='call/log' --exclude='data/*' --delete '*' | gzip > 2.tgz
but it deletes everyting, ignoring my exclude



Bill Marcum

2005-11-23, 5:54 pm

On Wed, 23 Nov 2005 03:06:51 GMT, RR
<tlane1@columbus.rr.com> wrote:
> I have a tared ziped archive and I want to --delete
> all files --exclude'ing a few that I want to keep
> within the archive.
>
> I wanted to use the --delete with gnu tar for
> efficiency, I know I can untar the whole thing to disk
> and tar back up what I want, but its taking too
> much time to go through all of them at night.
>
> I tried using --delete '*' --exclude 'log', but
> it almost looks like the --exclude does not apply to
> --delete command.
>
> are there a gnu tar arguments that would let
> me delete everyting except for a list of critical files.
>
> so for example my file (t.tgz) has these files
>
> call/log
> call/data/file1
> call/data/file2
> call/tmp/file3
>
> I want to keep log and data/*
> I tried using gnu tar 1.15.1
> cat t.tgz | gunzip |
> tar -f - --exclude='call/log' --exclude='data/*' --delete '*' | gzip > 2.tgz
> but it deletes everyting, ignoring my exclude
>

I think the way to do this is to extract the files you want to keep and
tar them into a new archive.


--
It is better to give than to lend, and it costs about the same.
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com