Finally worked this one out. There was a version problem. We were tasked to use the version of PERL in NTReskit (5.0.0.1). It does not work with any variation that we came up with or with the ones that this group suggested (thanks!) We have decided to install the stable release and then run the scripts.
Thanks -----Original Message----- From: John Marion [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 19, 2002 8:50 PM To: [EMAIL PROTECTED] Subject: directory creation help Well I changed the make up of lines 137 and 138. This is where the problem lies. I cannot make a drecotry that is part of the list that I use (ie: ...\apps\dll ) and then copy all the associated dll files into it. Anything would be greatly appreciated. John #!C:\NTRESKIT\perl #use File::Copy; #does C:\ntapps\common\C exist? #add user notification using Win32::Console $startdir = "\\ntapps\\common\\c"; @filespec = ('exe', 'dll'); #@filedelete = glob ("\\junk\\save\\*.*"); @filedelete = system ("del "."$savedir"."*.* /Q"); #@cmd = ('dir'); $savedir = 'C:\junk\save'; #sub searchDirectory; #sub builddirectory; if (-e "\\ntapps\\common\\c"){ #Find all EXE's and DLL's open (OUTFILE, '>\ntapps\log\mv_common_c.lst'); searchDirectory($startdir,"",@filespec); #removing files from junk\save #unlink @filedelete; #rename files using the system system ("rename" ,'C:\junk\save\*.*', '*.old'); close (OUTFILE); movefiles(); }else print "missing \n"; } # use THIS TO FIND EXE'S AND DLL's sub searchDirectory { # $startdir is a path name, @filespec is a list of file extensions only(ie: exe, dll, ...) local($basedir,$startdir,@filespec) = @_; local(@lines); local($subdir); local($lvl_counter); local($list_length); #print "got to search directory\n"; if(opendir (DIR,$basedir.$startdir)) { @lines = readdir (DIR); closedir (DIR); $lvl_counter = 2; $list_length = ( scalar @lines ); while ($lvl_counter < $list_length) { $subdir = $startdir."\\".$lines[$lvl_counter]; if(!searchDirectory($basedir,$subdir,@filespec)) { processnames($startdir.'|'.$lines[$lvl_counter],@filespec); } $lvl_counter++; } }else { return 0; } return 1; } sub processnames { # Give the value passed to this sub a sensible name. my ($filename,@filespec) = @_; $match = join '|', @filespec; if ($filename =~ /($match)$/i) { print (OUTFILE "$filename\n"); } } sub movefiles { local ($name, $path, $filename, $topath); #This is moving the files on the list we created to junk\save #open input file print "inputlist\n"; open (INPUTLIST, '<\ntapps\log\mv_common_c.lst'); foreach $file (<INPUTLIST>) { ($path,$name) = split (/\|/, $file); if (!-e $savedir.$path."\\" && !$path == "" ) { $topath = $savedir.$path; print "path:$path\n"; print "making directory: $topath\n"; #mkdir ($topath, 0777) || die "cannot mkdir $topath: $!"; #`C:\\john\\ldapps\\perl\\buildir.pl $savedir, $path`; ##closedir dumb; } if (!-d $basedir ) {print "ouch\n" } $command = 'copy '.$startdir.$path."\\".$name.' C:\junk\save'.$path; print "$command\n"; print "path:$topath, name:$filename\n"; system ($command); last; } close (INPUTLIST); } #this assumes that basedir exists sub builddirectory { local ($basedir, @path) = @_; local ($directory); @sublist = ($path <1) ? (split(/\\/, $path[0])) : (@path) ; print "$#path, $#sublist, @path, @sublist\n"; foreach $directory (@sublist) { if ($directory =~ /\s/) { next; } if (!-e $basedir.'\\' .$directory) {system (start, md 'C:\junk\save'. '\\' .$directory);} $basedir .= '\\'.$directory; #if (!-e $basedir.'\\' .$directory) { mkdir($basedir. '\\' .$directory, 0777); } #$basedir .= '\\'.$directory; print "$basedir\n"; } } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]