Last change
on this file since 24677 was 24677, checked in by jmt12, 13 years ago |
A tool for generating manifest files from import directories
|
-
Property svn:executable
set to
*
|
File size:
602 bytes
|
Line | |
---|
1 | #!/usr/bin/perl
|
---|
2 |
|
---|
3 | use strict;
|
---|
4 |
|
---|
5 | if (!defined $ARGV[0] || !-d $ARGV[0])
|
---|
6 | {
|
---|
7 | print "usage: manifestinator.pl <import directory>\n";
|
---|
8 | exit(0);
|
---|
9 | }
|
---|
10 |
|
---|
11 | my $dir = $ARGV[0];
|
---|
12 | if (!opendir(DH, $dir))
|
---|
13 | {
|
---|
14 | die ("Failed to open import directory for reading!\n");
|
---|
15 | }
|
---|
16 | my @files = readdir(DH);
|
---|
17 | closedir(DH);
|
---|
18 |
|
---|
19 | open(XMLOUT, '>:utf8', 'manifest.xml');
|
---|
20 | print XMLOUT "<Manifest>\n";
|
---|
21 | print XMLOUT " <Index>\n";
|
---|
22 |
|
---|
23 | foreach my $file (sort @files)
|
---|
24 | {
|
---|
25 | if ($file =~ /^\./)
|
---|
26 | {
|
---|
27 | next;
|
---|
28 | }
|
---|
29 | print XMLOUT " <Filename>" . $file . "</Filename>\n";
|
---|
30 | }
|
---|
31 |
|
---|
32 | print XMLOUT " </Index>\n";
|
---|
33 | print XMLOUT "</Manifest>\n";
|
---|
34 |
|
---|
35 | close(XMLOUT);
|
---|
36 | exit;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.