in reply to Re: manipulating cpio archive
in thread manipulating cpio archive
My script is$ cpio --list -i <td.cpio . t2 t1 t3 1 block $
The output tdnew.cpio is identical to td.cpio#!/opt/ActivePerl-5.12/bin/perl use Archive::Cpio; my $cpio = Archive::Cpio->new; $cpio->read('td.cpio'); $cpio->remove('t1'); $cpio->write('tdnew.cpio');
I think the answer is in the Archive::Cpio code. The entry should be removed in
I cannot decipher that last line but I do not like it (I may be completely wrong). How can I get this right? Thank you.sub remove { my ($cpio, @filenames) = @_; $cpio->{list} or die "can't remove from nothing\n"; my %filenames = map { $_ => 1 } @filenames; @{$cpio->{list}} = grep { !$filenames{$_} } @{$cpio->{list}}; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: manipulating cpio archive
by Corion (Patriarch) on Jan 17, 2011 at 18:39 UTC | |
by momo33 (Beadle) on Jan 17, 2011 at 19:20 UTC | |
by Corion (Patriarch) on Jan 17, 2011 at 19:34 UTC | |
by Anonymous Monk on Jan 17, 2011 at 20:06 UTC | |
by Corion (Patriarch) on Jan 17, 2011 at 20:15 UTC | |
|