
Mark1110
New User
Aug 19, 2011, 2:15 PM
Post #1 of 5
(2619 views)
|
help with scp command
|
Can't Post
|
|
Hi, I need to modify an scp command that is executed in a perl script. The current scp command is: `scp /broker/user/csp/myTestFile.txt pushme\@bridge.myCompany.com:/secureftp/myCompany/compass/testDirectory/OUTBOUND/test`; What I need to do is to add an date string to the file name. I wrote the following code: $timeStamp = &TimeStamp; $tranFileName = "myTestFile"; `scp /broker/user/csp/` .$tranFileName."_".$timeStamp.".txt". ` pushme\@bridge.myCompany.com:/secureftp/myCompany/compass/testDirectory/OUTBOUND/test`; sub TimeStamp { my ($sec,$min,$hour,$mday,$mon,$year, $wday,$yday,$iddst) = localtime(time); my $datestring; $year += 1900; $mon++; $mon = insert0($mon); $mday = insert0($mday); $min = insert0($min); $sec = insert0($sec); $datestring = "$year$mon$mday"; return($datestring); } sub insert0 { my ($date) = shift; if ($date < 10) { return "0$date"; } return $date; } I would like to file transmitted to be myFileName_20110819.txt. Can I break up the scp command like this? If not, how would it be written. Thanks, Mark
|