in reply to Access a particular drive on windows server

In your string, "\\" is an escape sequence that turns into "\":

my $DIR; $DIR = '\\ax-risvis447\c$\calc'; print $DIR; # prints "\ax-risvis447\c$\calc" # This gets you the string you want: $DIR = '\\\\ax-risvis447\c$\calc'; print $DIR; # prints "\\ax-risvis447\c$\calc" # And if you want to use double quotes, escape the "$" too: $DIR = "\\\\ax-risvis447\\c\$\\calc"; print $DIR; # prints "\\ax-risvis447\c$\calc"

However, you may still have issues due to shell escapes sometimes being tricky on Windows. For a "cleaner" way to list the files in a directory, see this recent thread for several approaches.

If you still have problems - what happens when you type in dir \\ax-risvis447\c$\calc on the command line?

As a general side note, you should be using use warnings; use strict; at the top of your scripts, to help avoid some common mistakes and typos.

Replies are listed 'Best First'.
Re^2: Access a particular drive on windows server
by nayabrahil (Novice) on Apr 24, 2014 at 14:00 UTC

    Thanks for the reply monk. Sorry, I am using the server : AX-RISCVMCRYS02

    When i ran the command dir \\AX-RISCVMCRYS02\C$\CALC on the command prompt.
    I am getting the same error

    Same error as the perl file:

    The system cannot find the file specified.
    \\AX-RISCVMCRYS02\C$\CALC

      Then the error you're seeing in Perl is actually coming from your OS, and you need to solve that problem first. Since we don't know anything about your network setup, your network administrator will likely be of much more help. (Just an idea, you may need to supply login credentials and/or mount the network share via something like net use.)