comparison g23m/system/busyb/tools/save_files.pl @ 0:509db1a7b7b8

initial import: leo2moko-r1
author Space Falcon <falcon@ivan.Harhan.ORG>
date Mon, 01 Jun 2015 03:24:05 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:509db1a7b7b8
1 #!perl -w
2 use strict;
3 use File::Copy;
4 use File::Glob ':glob';
5
6 # define global variables
7 my $outCmdFile;
8 my $inPPFile;
9 my $cmdFile;
10 my $outDir;
11 my @cmdFiles;
12
13 # check command line
14 (@ARGV == 2) || die "To few/much parameters !\n";
15
16 $outCmdFile = $ARGV[0]; # a full filename
17 $inPPFile = $ARGV[1]; # a full filename
18
19 # get the output directory from the first parameter
20 if ($ARGV[0] =~ /(.*)(\\|\/)/ ) {
21 $outDir = $1;
22 }
23 else {
24 $outDir = ".";
25 }
26
27 #copy the *.pp file to it's new location
28 copy($inPPFile,$outDir ) || print "Could not copy $cmdFile to $outCmdFile!\n";
29
30 # find the original cmd file
31 @cmdFiles = bsd_glob("$outDir/*.cmd");
32 if (@cmdFiles != 1) {
33 print "More/less than one cmd file found !\n";
34 exit;
35 }
36 $cmdFile = $cmdFiles[0];
37
38 #copy (and rename) the cmd file to it's new location
39 copy($cmdFile,$outCmdFile ) || print "Could not copy $cmdFile to $outCmdFile!\n";
40
41
42
43
44
45