source: trunk/soft/ObsData/examples/obsarchive @ 17

Last change on this file since 17 was 17, checked in by thauvin, 19 years ago
  • typo (commit too quickly)
  • Property cvs2svn:cvs-rev set to 1.3
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 652 bytes
Line 
1#!/usr/bin/perl
2
3# Olivier Thauvin <olivier.thauvin@aerov.jussieu.fr>
4# CNRS Service d'Aeronomie
5
6# $Id$
7
8use strict;
9use warnings;
10use Getopt::Long;
11use ObsData::Archive;
12
13GetOptions();
14
15sub help {
16    print qq(
17Usage $0 ARCHIVE [FILE]
18List an archive or extract FILE from archive into current directory
19)
20}
21
22my ($archive, $files) = @ARGV;
23
24$archive or do {
25    help();
26    exit(1);
27};
28
29my $ar = ObsData::Archive->new($archive) or die "Can't read archive\n";
30
31if ($files) {
32    my ($basename) = $files =~ /.*\/(.*)/;
33    $ar->extract($files, "./$basename") or die "Can't extract files\n";
34} else {
35    foreach($ar->ls) {
36        print "$_\n";
37    }
38}
Note: See TracBrowser for help on using the repository browser.