#Open the directory opendir (DIR, "http://yoda/Documents/PSG/Customers/") || die ("Unable to open directory"); #Read list of files in the directory while ($filename = readdir(DIR)) { @files = readdir(DIR); } closedir(DIR); #Remove the file . which represents the current directory shift (@files); #Go through each of the files in the directory foreach $file (@files) { #Open subfolder open (DIR, "http://yoda/Documents/PSG/Customers/$file/Support/sitemap/") #code here copies each document from subfolder to c:\sitemaps }