Line | |
---|
1 | #!/usr/bin/perl |
---|
2 | # a Perl script to copy a list of files into a target dir |
---|
3 | # usually invoked through 'Makefile install' |
---|
4 | |
---|
5 | if ( $#ARGV < 1 ) { |
---|
6 | print "expect at least 2 args:\n"; |
---|
7 | print "(1) file to be installed and (2) installation directory\n" ; |
---|
8 | exit ; |
---|
9 | } else { |
---|
10 | $installationDir = @ARGV[$#ARGV]; |
---|
11 | $existsInstallationDir = `ls -d $installationDir | wc -l`; |
---|
12 | if ($existsInstallationDir==0) {die "target directory does not exist\n";} |
---|
13 | @files = (); |
---|
14 | for (my $i = 0; $i <= $#ARGV-1; $i++ ) { |
---|
15 | my $file = @ARGV[$i]; |
---|
16 | $existsFile = `ls $file | wc -l`; |
---|
17 | if ($existsFile==0) {die "file '$file' does not exist locally\n";} |
---|
18 | @files = (@files, $file); |
---|
19 | } |
---|
20 | # now do the coy |
---|
21 | foreach $file (@files) { |
---|
22 | `cp $file $installationDir`; |
---|
23 | } |
---|
24 | |
---|
25 | } |
---|
26 | |
---|
27 | |
---|
Note: See
TracBrowser
for help on using the repository browser.