I know the paths to the folders are correct becuase if I take out the part where it actually moves the folders it works fine.

Here is the command line:
C:\Documents and Settings\Tim\My Documents\test1>perl readdir.plx
Access is denied.

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

In reply to Re^2: Server access denied when checking for files by bobdole
in thread Server access denied when checking for files by bobdole

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.