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

To all my Perl Monks,
I'm on a certain machine, when i want to navigate trough my folders i use chdir "blabla";
so i would like to navigate trough an another machine of the server. i'm trying a path like this but it's not working:
chdir '\\machine\folder1\folder2\folder3';
thanks for your answers

Replies are listed 'Best First'.
Re: chdir for another machine
by samurai (Monk) on Nov 07, 2002 at 16:43 UTC
    Sounds like you're on a windows machine. I believe perl will support anything that the dos shell will support on filesystems. In other words, if you can't "cd" in dos to \\machine\folder, then perl can't chdir to it (which is the case here).

    I would suggest mounting \\machine\folder1 or whatever on one of your drive letters (M:, N:, etc) and THEN chdir'ing in perl to that directory.

    --
    perl: code of the samurai

      I just tried it, and it works fine if I double-up the backslashes inside the quotes.

      Perl changed the current directory for the process. Then when doing a system('dir') the stupid CMD.EXE shell reports "'\\FOO\BAR' is an invalid current directory path. UNC paths are not supported. Defaulting to Windows directory.".

      —John

      What does the brain-dead COMMAND.COM or CMD.EXE shell have to do with it? 4DOS/4NT has always supported chdir'ing to network paths and UNC names, even though MS's stuff did not. The native change-directory function in the Windows API supports UNC names; if Perl passes through to that unmunged it should work.
      k i taught to do this but it's the way i wanted to do it. I'll try another way. thanks anyways