Skip to content

Instantly share code, notes, and snippets.

@moltar
Created October 30, 2012 20:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moltar/3982724 to your computer and use it in GitHub Desktop.
Save moltar/3982724 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use warnings;
use strict;
use Archive::Tar;
my $filename = $ARGV[0];
die "Specify filename as first argument.\n" unless $filename;
my $tar = Archive::Tar->new;
$tar->read($filename);
if ($tar->contains_file('./')) {
$tar->remove('./');
$tar->write($filename);
} else {
warn "No root entry in $filename\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment