use File::Copy; ## set up directories my $in_dir = '/dir/main'; my @xfer_dirs = qw! /dir/dir_1 /dir/dir_2 /dir/dir_3 !; ## list of files in $in_dir my @infiles; ## pick a random dir to start ## so salesperson 1 doesn't get more mail when the job restarts my $xfer_dir_index = int rand @xfer_dirs; { ## create a directory handle local *DH; ## open the directory opendir( DH, $in_dir ) or die "ERROR: $0 - can't open dir $in_dir - +$!"; ## get a list of files @infiles = grep { /^\./ && -f "$in_dir/$_" } readdir(DIR); ## close the directory closedir DH; } for @infiles { ## move the file move( $in_dir . '/' . $_, $xfer_dirs[$xfer_dirs_index] . '/' . $_ ); ## cycle the directory index $xfer_dir_index++ $xfer_dir_index %= @xfer_dirs; } ## sleep sleep(300);
~Particle *accelerates*
In reply to Re: sequential file handling (again)
by particle
in thread sequential file handling (again)
by airblaine
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |