use IO::Dir; use File::Copy; use Fcntl ':mode'; use strict; use warnings; use Net::ftp; use Net::Ping; use Time::localtime; use POSIX ":sys_wait_h"; system ("color 1f"); my $indir = ".\\in"; my $outdir = ".\\out"; my $expr = "*.*"; my $RemFile = "*.*"; my $d; if ( ! -e $indir ){ print "$indir does not exist, attempting to create\n"; mkdir ($indir, 0777 ) or die "Can not create $indir: $!"; } if ( ! -e $outdir ) { print "$outdir does not exist, attempting to create\n"; mkdir ($outdir, 0777 ) or die "Can not create $outdir: $!"; } while(1){ $d = new IO::Dir "$indir"; my %dir; tie %dir, 'IO::Dir', "$indir"; foreach (keys %dir) { #if the expr is found in the InDir it will be FTP'd if( ! S_ISDIR($dir{$_}->mode) && /^$expr/ ) { my $pid; if($pid = fork){ waitpid(-1, &WNOHANG); } else{ $RemFile = $_; #move the file to the out directory move( "$indir/$_", "$_"); #chdir ($outdir); print "Starting to FTP: $_\n"; system("FTP_Client.exe $_"); print "Finished: $_ \n\n"; move( "$_", "$outdir/$_"); exit(1); } } #sleep(5); } }
In reply to Re^3: Start windows .exe
by NateTut
in thread Start windows .exe
by amt35
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |