Hello All, I am currently developing a script on Perl 5.001 in Windows 2000 but targeted for WIndows NT 4.0. I have scan through the list and seen the answer on File::*. Unfortunately, the perl version I have does not have the FIle::Path module (or is it?). Here's the purpose of my script. The script runs a application that find a set of files and empty directories that needs to be copy from several root directories. Unfortunately, the command must be run from a specific directory. So my script has to find the originating root directory, substituing portion of the command directory. Example: A set of files and directories: \PCA001\web\list.txt \PCA013\web\mymy.txt \PCA005\web\folder The result of running the application command: \Release\ACT\update_folder\web\list.txt : PCA001 \Release\ACT\update_folder\web\mymy.txt : PCA013 \Release\ACT\update_folder\web\folder : PCA005 Substituting to become: \PCA001\web\list.txt \PCA013\web\mymy.txt \PCA005\web\folder Once that is done, it recreates the files and directories into the target directory. Unfortunately, my script has ran into two problems and I don't understand what is causing them. The first is that the -f file test does not seems to work. This may be related to the second problem. The substitution is not occuring, which may be why it cannot detect the file as it is poiting back to the originating directory. I have include the code and mark the error areas with <<== *** Error: Can anyone help? TIA. ### retrieve the inpur arguments by shifting @ARGV -------------------------------------# $label = shift(@ARGV); $voblist = shift(@ARGV); ### find the temporary directory -------------------------------------------------------# if ($ENV{TEMP}) { $tdir=$ENV{TEMP}; } else { $tdir="c:\\temp"; } ### prepare the temporary file ---------------------------------------------------------# $prog = "$0"; $prog =~ s/.*\\// ; $tmpfx = $tdir . "\\". $prog . "." . $$; $tmpcmd = $tmpfx . ".cmd"; $outfile = $tdir . "\\output" . "." . "txt"; ### prepare set environment variable command -------------------------------------------# $voblist =~ s/\\/\\\\/; $setenv = "set CLEARCASE_AVOBS="; $setenv = $setenv . $voblist; ### prepare set viewroot mapped network drive command ----------------------------------# $drive = "X:"; $dft_view = "\\Update_UAT"; $destdir = "y:"; $netmap = $drive . "\\" . $dft_view . $voblist; ### prepare cleartool lsco command -----------------------------------------------------# $lsco = "cleartool lsco -avobs -fmt \"%n;%Tf;%l\"\\n"; ### execute the commands ---------------------------------------------------------------# &CleartoolInp(" $setenv $drive chdir $dft_view $lsco > $outfile "); ### parse result output for label and mkdir/copy file to destination -------------------# if (-e "$outfile") { open(OUTFILE, "$outfile") or die ("Error: Cannot open result file in $tdir"); while (<OUTFILE>) { if ($_ =~ /$label/) { ($path,$view) = split(/;/,$_); ($from = $path) =~ s/$dft_view/$view/i; <<== *** Error ($to = $path) =~ s/$netmap/$destdir/i; <<== *** Error if (-e $to) { if (-f $to) { system("copy /Y $from $to"); } <<== *** Error } else { if (-d $from) { system("mkdir $to"); } else { @dirpath = split(/\\/,$to); pop(@dirpath); $dirpath = join("\\",@dirpath); if (! -e $dirpath) { system("mkdir $dirpath"); } system("copy /Y $from $to"); } } } } close; } else { die ("Error: Cannot find $outfile"); } ### SUBROUTINES ######################################################################### ### cleartoolInp - execute commands suing system process -------------------------------# sub CleartoolInp { open(TMP, ">$tmpcmd"); print TMP "$_[0]"; close(TMP); system("cmd < $tmpcmd"); } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]