CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
saving the output in a different folder

 



sidhusaladi
New User

Dec 18, 2012, 1:55 PM

Post #1 of 3 (1036 views)
saving the output in a different folder Can't Post

i actaully am trying to encrypt some data using an exe file but the data encrypted i beeing saved into the same folder how do i save it into a diff folder



#!/usr/bin/perl -w
use strict;


my $os = $ENV{ "OS" }; # indicates Windows os
my $Exec = '../Crypt/';
my $scriptPath = '../Scripts/';
my $encrypath = '../EncryptedScripts/';
my $fileName = '*.st';
my $fileSpec = "${scriptPath}${fileName}";
my $cmdString = '$Exec -i $file -o $outfile -e';



if( defined( $os ) && ( $os =~ /^Window/ ))
{

$Exec = "..\\Crypt";
$scriptPath = "..\\Scripts\\";
$encrypath = "..\\EncryptedScripts\\";
}




print $fileSpec . "\n";

my @files = <${fileSpec}>;
my @results;

print "Before the For Loop \n";

foreach my $file (@files) {

my $outfile = $encrypath . $file;
$outfile = $outfile . 'e';


my $cmd = "$pegCryptExec -i $file -o $outfile -e";
my @results = `$cmd 2>&1`;

print $file . " encrypted to " . $outfile . "\n";}


wickedxter
User

Dec 18, 2012, 5:45 PM

Post #2 of 3 (1030 views)
Re: [sidhusaladi] saving the output in a different folder [In reply to] Can't Post

whats not working? whats working?

so im guessing my $encrypath isnt working? in windows OS i think the path to the folders must be absolute meaing c:/some/folder/to/somewhere not '../folder/' but i could be wrong.


BillKSmith
Veteran

Dec 19, 2012, 10:03 AM

Post #3 of 3 (1020 views)
Re: [sidhusaladi] saving the output in a different folder [In reply to] Can't Post

The code that you posted is not the code that you ran. I does not even compile!

I recommend that you print $cmd before you execute it. If it is exactly what you expect, try that command from your command line. If it does not work there, it is not a perl problem at all. If the command is not formed correctly, you will be able to ask the right question.
Good Luck,
Bill

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives