xorl has asked for the wisdom of the Perl Monks concerning the following question:

I know there's already a node that addresses this (globbing on remote network paths) However the proposed solutions don't seem to work for me.
#!/usr/bin/perl use strict; use File::Glob qw(bsd_glob); my @dirlist = glob('\\\\servername\\path\\to\\docs\\with space in the +path\\for the directory\\*'); foreach my $dir (@dirlist) { print $dir . "\n"; }
Output:
servernamepathtodocswith space in the pathfor the
(note the last word doesn't appear in the output, if that matters at all)

I'm writing and running the script on a Linux box, the remote box is a Win box.

I've also tried as many combinations of \\ or \ or / or // just in case that was the problem, but it doesn't seem to help.

What could be the problem?

Thanks in advance

Replies are listed 'Best First'.
Re: globbing on remote network paths
by Corion (Patriarch) on Sep 25, 2008 at 16:41 UTC

    glob does not have sane defaults regarding whitespace. I recommend the following line at the top of your program to enable sane whitespace defaults for glob by replacing it with File::Glob:

    use File::Glob qw(bsd_glob);

    That will remove the use of whitespace as a glob spec separator and will make glob() work the way it should, by simply wildcard-expanding its single argument.

Re: globbing on remote network paths
by moritz (Cardinal) on Sep 25, 2008 at 16:10 UTC
    The handling of network paths is quite differently on linux. They have to be mounted to be accessible, and then you don't need any special special syntax because they work just like local file systems.
      Ok I was afraid that might be part of the problem.

      We don't want to mount it on that box. Instead I'm going to use File::SmbClient