Debian Codegraph @

script/ecaccess-file-rmdir

raw
1 #!/usr/bin/perl -w
2 #
3 # ecaccess-file-rmdir: Remove a Directory on the ECaccess File System
4 #
5 # [email protected] - 2010-10-15
6
7 use ECMWF::ECaccess;
8 use Getopt::Long;
9 use Pod::Usage;
10
11 my %opt = ( version => 0, help => 0, manual => 0, retry => 0, debug => 0 );
12
13 pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions(
14 \%opt,
15 qw(
16 version
17 help|?
18 manual
19 retry=i
20 debug
21 )
22 );
23
24 # Display version if requested
25 die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} );
26
27 my $ecaccessFile = $ARGV[0];
28
29 pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} );
30 pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} );
31 pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No ecaccess-file specified!\n" ) if not($ecaccessFile);
32
33 # Create the ECaccess Controler
34 my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug});
35
36 # Get the Token (using the Certificate in $HOME)
37 my $token = $ecaccess->getToken();
38
39 # Get the Control Channel
40 my $controlChannel = $ecaccess->getControlChannel();
41
42 # Delete the file
43 $controlChannel->removeDirectory( $token, $ecaccessFile );
44
45 # Logout
46 END {
47 $ecaccess->releaseToken($token) if ($token);
48 }
49
50 __END__
51
52 =head1 NAME
53
54 ecaccess-file-rmdir - Remove a Directory on the ECaccess File System
55
56 =head1 SYNOPSIS
57
58 B<ecaccess-file-rmdir -version|-help|-manual>
59
60 B<ecaccess-file-rmdir [-debug]> I<ecaccess-file>
61
62 =head1 DESCRIPTION
63
64 Allow removing the Directory I<ecaccess-file> on the ECaccess File System.
65
66 The I<ecaccess-file> is in the form [domain:][/user-id/]path. Please read the "Shell commands -> File Management"
67 section of the "ecaccess" guide for more information on the ECaccess File System.
68
69 =head1 ARGUMENTS
70
71 =over 8
72
73 =item I<ecaccess-file>
74
75 Then name of the ECaccess Directory to remove.
76
77 =back
78
79 =head1 OPTIONS
80
81 =over 8
82
83 =item B<-version>
84
85 Display version number and exits.
86
87 =item B<-help>
88
89 Print a brief help message and exits.
90
91 =item B<-manual>
92
93 Prints the manual page and exits.
94
95 =item B<-retry> I<count>
96
97 Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the
98 initial SSL connection initiated by the command to the ECMWF server. It does not
99 apply to all the subsequent requests made afteward as it is mainly targeting errors
100 that can happen from time to time during the SSL handshake. Default is no retry.
101
102 =item B<-debug>
103
104 Display the SOAP and SSL messages exchanged.
105
106 =back
107
108 =head1 EXAMPLES
109
110 B<ecaccess-file-rmdir> I<c1a:/c1a/tmp/systems/xyz/test-dir>
111
112 Remove the I<test-dir> Directory in the "/c1a/tmp/systems/xyz" directory on c1a.
113
114 =head1 SEE ALSO
115
116 B<ecaccess-file-delete>, B<ecaccess-file-get>, B<ecaccess-file-mget>, B<ecaccess-file-modtime>, B<ecaccess-file-mput>,
117 B<ecaccess-file-chmod>, B<ecaccess-file-copy>, B<ecaccess-file-dir>, B<ecaccess-file-mdelete>, B<ecaccess-file-mkdir>,
118 B<ecaccess-file-move>, B<ecaccess-file-put>, B<ecaccess-file-size> and B<ecaccess>.
119
120 =cut