airblaine has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use Proc::Daemon; Proc::Daemon::Init; use File::Copy; @dirs=qw(/mail/act1/ /mail/act2/ /mail/act3/ /mail/act4/); while(1){ $dir="/mail/main/"; opendir(MAIN,$dir) or die "Can't open $dir:$!"; while(defined($file = readdir MAIN)){ next if $file =~/^\.\.?$/; $path=$dir.$file; $newdir=@dirs[$i]; move ($path,"$newdir$file") or die "move failed:$!"; $i++; undef $i if ($i>$#dirs); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Limiting CPU usage on this program...
by Abigail-II (Bishop) on Jun 04, 2002 at 16:51 UTC | |
|
Re: Limiting CPU usage on this program...
by particle (Vicar) on Jun 04, 2002 at 17:22 UTC | |
|
Re: Limiting CPU usage on this program...
by vladb (Vicar) on Jun 04, 2002 at 17:43 UTC | |
|
Re: Limiting CPU usage on this program...
by airblaine (Acolyte) on Jun 04, 2002 at 18:14 UTC | |
|
Re: Limiting CPU usage on this program...
by ehdonhon (Curate) on Jun 04, 2002 at 19:10 UTC |