#!/usr/local/bin/perl use strict; use diagnostics; my $DIR_A = "/u/web/smpsvc/bulletin"; my $DIR_B = "/u/web/smpsvc/espanol/bulletin"; opendir DIR, "$DIR_A"; while(defined(my $item = readdir DIR)){ open FILE,"$DIR_A/$item" or warn "$!", next; open COPY,"COPIES/$item" or warn "$!", next; while (read FILE,my $buffer,4096){ print COPY $buffer; } close FILE; close COPY; exec("mv","$DIR_A/$item","$DIR_B/$item"); # performes an mv command like on the command line } closedir DIR;