1 |
On Friday 24 March 2006 15:36, Boyd Stephen Smith Jr. wrote: |
2 |
> > > Michael Kintzios wrote: |
3 |
> > > > what I think is needed |
4 |
> > > > here is untarring of the archive, while untarred data is |
5 |
> > > > dynamically deleted immediately after untarred to make space for |
6 |
> > > > more data to be untarred . . . do I make sense? |
7 |
> > > |
8 |
> > > Yes, but GNU tar cannot do that, it can only do one command at a |
9 |
> > > time, either --extract or --delete or ... |
10 |
> > |
11 |
> > Yes, that's why I was hoping that some clever bash-ery may be able to |
12 |
> > pipe the lot together. |
13 |
> |
14 |
> Perhaps: |
15 |
> tar xvf gentoo_usr.tar | while read file; do tar --delete f gentoo_usr.tar |
16 |
> "$file"; done |
17 |
> |
18 |
> That might just screw up your tar file and/or extract junk; I didn't test |
19 |
> it at all. |
20 |
|
21 |
ROFL. |
22 |
|
23 |
No that won't work. ;) You cannot delete while extracting and when extraction |
24 |
is completed there is no point. This, however, does work: |
25 |
|
26 |
tar tf gentoo_usr.tar | sort -r | while read file; do tar -xf gentoo_usr.tar |
27 |
"$file" && tar --delete -f gentoo_usr.tar "$file"; done |
28 |
|
29 |
First of all the dash before f when deleting is necessary. That's just syntax. |
30 |
Secondly the sort -r is VERY important to make sure it extracts the deepest |
31 |
files (in terms of path) first then deletes them. Both -x and --delete or |
32 |
recursive by default. |
33 |
|
34 |
The problem with this, however, is that it only works with a tar file. |
35 |
Apparently it is not possible to delete a file from a compressed tar file. |
36 |
|
37 |
-- |
38 |
Bo Andresen |
39 |
-- |
40 |
gentoo-user@g.o mailing list |