in reply to Server access denied when checking for files

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

Replies are listed 'Best First'.
Re^2: Server access denied when checking for files
by chas (Priest) on Apr 26, 2005 at 15:12 UTC
    On my machine, a command like "C:\Documents and Settings\Tim\My Documents\test1>perl readdir.plx" doesn't work (produces a "Bad Command" error.)
    Try "perl readdir.plx < C:\Documents and Settings\Tim\My Documents\test1" (or maybe a pipe instead of the ">").
    That may be unrelated to your problem, though. As I mentioned in a previous reply, I think your last foreach loop is logically garbled. Why are you operating on the files in dismissed2.txt for each $f in @thefiles? And won't that just work for the first $f? (You will have reached end of file in dismissed2.txt after that.) (That may also be unrelated to the specific error you mention, though...)
    chas