#!/usr/bin/perl # a Perl script to copy a list of files into a target dir # usually invoked through 'Makefile install' if ( $#ARGV < 1 ) { print "expect at least 2 args:\n"; print "(1) file to be installed and (2) installation directory\n" ; exit ; } else { $installationDir = @ARGV[$#ARGV]; $existsInstallationDir = `ls -d $installationDir | wc -l`; if ($existsInstallationDir==0) {die "target directory does not exist\n";} @files = (); for (my $i = 0; $i <= $#ARGV-1; $i++ ) { my $file = @ARGV[$i]; $existsFile = `ls $file | wc -l`; if ($existsFile==0) {die "file '$file' does not exist locally\n";} @files = (@files, $file); } # now do the coy foreach $file (@files) { `cp $file $installationDir`; } }