Perl CAN access windows directories with spaces in the directory path.  You
can test it out like this:

opendir(DIR,"\\\\testmachine\\c\$\\program files");
my @files = readdir(DIR);
print @files;

I'm afraid I can't help you too much with your code, however, because I know
next to nothing about CGI.  Have you tried printing the contents of the
variable after the concatenation to make sure there aren't extra spaces or
newlines in it?

-----Original Message-----
From: Eric Peers [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 28, 2002 12:53 PM
To: [EMAIL PROTECTED]
Subject: network file directories and directory names with spaces


Based on a lack of replies to my post of yesterday, I'm assuming that perl
running on a Windows machine can not access a Windows directory with spaces
in the directory path (i.e. D:\scripts\perl script files\).  I've been given
permission to change the spaces to underscores, so for the moment that
problem is solved though it would be nice know whether perl can read
directories with spaces in the path.  I admit that I have not tried the
opendir command to see if this solves the problem.

My second question is whether perl can read across a Windows network?  I've
tried \\\\wvit9\\work\\ and have mapped the network drive to the web server
in an attempt to get the perl script to read the files on a remote server
with no success.  So, what obvious thing am I missing?

Installing perl on the remote system would solve the remote directory
problem, however there are issues that prevent me from installing
ActivePerl, so I'm looking for of globbing the files across the network.

Any thoughts will be helpful.  Even if its no, you can't do this..


Code samples:

#! /usr/bin/perl -w

use strict;
use CGI qw(:standard);
use File::Basename;

my $dir =
"D:\\Inetpub\\wwwroot\\kfvstart\\intranet\\Eric\\Logos\\Active_Logos_600_dpi
\\";  #This works.
# these do not work
#my $dir = "G:\\E-drive\\Logos\\";
#my $dir = "\\\\Logoserver\\Logos\\";
#my $dir = "\\\\WVPCIT9\\Work\\";
#my $dir = "H:\\"; # The work directory on my PC.


The heart of the search:

    $criteria = param('criteria');
    $search = $dir . $criteria;
    while ($files = <$search*>) {
        $counter++;
        $files =~ s#.*/##; #remove part before last slash
        my ($name, $directory, $extension) = fileparse($files,'\..*');
        my $filename = $name . $extension;
        my $uri = "http://wv1svlg001/Active%20Logos%20600%20dpi/"; .
$filename;
        if ($counter % 2) {
            print '<tr bgcolor="#e8e8e8"><td nowrap>';
        } else {
            print '<tr><td nowrap>';
        }
        print "<a href=$uri>$filename</a><br>";
        print '</td></tr>';
    }

Thanks,

Eric


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--------------------------------------------------------------------------------
This email may contain confidential and privileged 
material for the sole use of the intended recipient. 
If you are not the intended recipient, please contact 
the sender and delete all copies.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to