Can you possibly post your code up here (enclosed in the proper tags so that we can see what is going on?
Regards,
Jeff
All,
Here is the overview of code:
We have two types of "MOVES" Full and Inc
Inc moves
- make sure all the directories exist
- move all files from droppoint to current
Full
- make sure all the directories exist
- remove the previous directory
- rename the current directory to previous
- make a new directory called current
- move the files from droppoint to current
Actual code:
-
sub system_call {
-
($lcl_cmd, $junk) = @_;
-
local $function_name = "system_call";
-
logmsg( $function_name, "Doing system call $lcl_cmd" );
-
print "\nDoing system call :$lcl_cmd:\n";
-
local $rc = system( $lcl_cmd );
-
logmsg( $function_name, "The return code is ->$rc<-" );
-
print "\nrc is :$rc:\n";
-
return $rc;
-
} # end system_call subroutine
-
-
$rootloc="c:\\Logs\\";
-
$droppoint="droppoint";
-
$currentdir="current";
-
$previousdir="previous";
-
-
@inc_cmds = (
-
"move $rootloc$droppoint\*\.\* $rootloc$currentdir"
-
);
-
-
@full_cmds = (
-
"rmdir \/S \/Q $rootloc$previousdir"
-
,"rename $rootloc$currentdir $previousdir"
-
,"mkdir $rootloc$currentdir"
-
,@inc_cmds
-
);
-
-
#
-
# check to make sure the three directories exist
-
#
-
$dir_name = $rootloc . $previousdir;
-
logmsg( $functionname, "Checking for $dir_name." );
-
opendir(DIRANDLE, $dir_name) || die "Can not open the directory :$dir_name:\n";
-
close(DIRHANDLE);
-
-
$dir_name = $rootloc . $currentdir;
-
logmsg( $functionname, "Checking for $dir_name." );
-
opendir(DIRANDLE, $dir_name) || die "Can not open the directory :$dir_name:\n";
-
close(DIRHANDLE);
-
-
$dir_name = $rootloc . $droppoint;
-
logmsg( $functionname, "Checking for $dir_name." );
-
opendir(DIRHANDLE, $dir_name) || die "Can not open the directory :$dir_name:\n";
-
close(DIRHANDLE);
-
-
$sleep_sec = 10;
-
logmsg( $functionname, "Sleeping for $sleep_sec seconds." );
-
sleep( $sleep_sec );
-
-
if ( $move_type eq "F" ) {
-
@cmd_list = @full_cmds;
-
} else {
-
@cmd_list = @inc_cmds;
-
}
-
-
-
foreach $cmd (@cmd_list) {
-
print "\ncmd is $cmd.\n";
-
$rc = system_call( $cmd );
-
if ( $rc != 0 ) {
-
exit( -1 );
-
} #end $rc check
-
$sleep_sec = 10;
-
logmsg( $functionname, "Sleeping for $sleep_sec seconds." );
-
sleep( $sleep_sec );
-
} #end foreach loop
-
THANKS!!!