#!/usr/bin/perl
$dirtoget="\\\\Server\\Bankpro"; #directory to read folders
opendir(IMD, $dirtoget) || die("Cannot open directory"); #open directory
@thefiles= readdir(IMD); #store all files and folders in directory into an array
closedir(IMD); #close directory
open (filenames, "dissmissed2.txt") || die ("Could not open file.
$!"); #open list of file names
$text = ; #read in one line from txt file
$defaultdir = "\\\\Server\\Bankpro"; # Directory containing original folders
$destinationdir = "\\\\Server\\BPdismis"; # Directory to copy folders to
foreach $f (@thefiles) #for each file in the directory
{
unless ( ($f eq ".") || ($f eq "..") ) #dont move unless its a file of folder
{
while ($text){ #while there is a line of text
$text =~ s/\s+$//; #strip off whitespace, newline and tabs
system qq(move /y "$defaultdir/$text" "$destinationdir"); #move files to diffrent directory
$text = ; #read in next line from file
}
}
}
close (filenames); #close list of files