I changed the code to check for success on those lines
#!/usr/bin/perl
$dirtoget="\\\\Server\\Bankpro"; #directory to
+read folders
opendir(IMD, $dirtoget) || die("Cannot open directory"); #o
+pen directory
@thefiles= readdir(IMD) or die "can't readdir: $!"; #st
+ore 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 = <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 "..") )
{
while ($text){ #whi
+le there is a line of text
$text =~ s/\s+$//; #s
+trip off whitespace, newline and tabs
system qq(move /y "$defaultdir/$text" "$destinationdir") or di
+e "can't move the file: $!"; #move files to diffrent directory
$text = <filenames>;
+ #read in next line from file
}
}
}
close (filenames); #close list of files
And I still get the same response in the command prompt
C:\Documents and Settings\Tim\My Documents\test1>perl readdir.plx
Access is denied.
I just tried to move a test folder from the command prompt and it gave me the same access denied
C:\Documents and Settings\Tim\My Documents\test1>MOVE \\Server\Bankpro\test "\\S
erver\BPdismis"
Access is denied.
So I guess it has something to do with permissions, maybe its more of a windows question then perl then. I just dont understand if I can view and move the folders on the server from my client why I cant do it from the command line.
Thanks
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.