#!/usr/bin/perl -w use strict; my $path1 = "C:\\foo\\dir1"; my $path2 = "C:\\foo\\dir2"; opendir DIR, $path1 || die "\n\nUnable to open $path1. Error: $!\n\n"; my @files = readdir DIR; closedir DIR; for (my $f = 0; $f < scalar(@files); $f++) { # test to see if it's a dir if ($files[$f] ne "." and $files[$f] ne ".." and $files[$f] !~ /\//) { unless(-e "$path2\\$files[$f]") { exec("copy $path1\\$files[$f] $path2\\") || die "\n\nUnable to copy $files[$f]. Error: $!\n\n"; }