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 | |
by Anonymous Monk on Apr 24, 2014 at 14:50 UTC |