Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: How to access Storage hidden share

by NetWallah (Canon)
on Jan 24, 2014 at 05:47 UTC ( [id://1071882]=note: print w/replies, xml ) Need Help??


in reply to How to access Storage hidden share

Welcome to the Monastery!

Here is an old thread on this subject.

I'd recommend following Corion's recommendation - there is no need to map a drive in order to create files on the share - just use the UNC path.

Try just opening the file at the UNC location, and writing to it.

If you run into trouble, post your code here, (along with how you expect it to behave) and we'll be glad to assist.

        If your eyes hurt after you drink coffee, you have to take the spoon out of the cup.
              -Norm Crosby

Replies are listed 'Best First'.
Re^2: How to access Storage hidden share
by smw11 (Initiate) on Jan 28, 2014 at 06:18 UTC
    Hi, Thanks for the information. I have to update perl script for "I" drive mapping. &resetDriveMapping( "I:", $diskArchive ) ; I have to change perl script I map from "\\store\project" to \\store\projectnew$. The new share is hidden format($). I used following function to test the mapping. thank you. smw11
    sub resetDriveMapping { my $isDriveLetter = shift ; my $isSharename = shift ; my $Ifiletest = "$isDriveLetter\\idriveTESTfrom" . $ENV{COMPUTERNA +ME} . ".txt" ; my $Itestmsg = "...resetting: \'$isDriveLetter\' drive mapping fro +m \'$ENV{COMPUTERNAME}\' to \'$isSharename\'" ; &writeLogFile($Itestmsg); my $runCommand = "echo Y|net use $isDriveLetter /DELETE" ; my $retvalue = system($runCommand); if ($retvalue) { &writeLogFile("cannot delete drive $isDriveLetter"); } $runCommand = "net use $isDriveLetter $isSharename" ; $retvalue = system($runCommand); if ($retvalue) { &writeLogFile("cannot map drive $isDriveLetter to $isSharename +"); } #test share mapping $Itestmsg = "...start testing: \'$isDriveLetter\' drive mapping fr +om \'$ENV{COMPUTERNAME}\' to \'$isSharename\'" ; &writeLogFile($Itestmsg); open(ITEST, ">$Ifiletest" ) || &writeLogFile("cannot CREATE $Ifile +test") ; print ITEST "$Itestmsg\n" ; close(ITEST) ; if ( ! -e "$Ifiletest" ) { &writeLogFile("EXITing: test file does not exist \'$Ifiletest\ +'"); exit(0) ; } open(ITEST, "$Ifiletest" ) || &writeLogFile("cannot OPEN $Ifiletes +t") ; my $Itestbuf = "" ; while (<ITEST>) { $Itestbuf = $_ ; } close(ITEST) ; unless ( $Itestbuf ) { &writeLogFile("EXITing: could *not* read test content \'$Ifile +test\'"); exit(0) ; } else { unlink( $Ifiletest ) || &writeLogFile("could not DELETE $Ifile +test") ; &writeLogFile("...end testing: \'$isDriveLetter\' drive mappin +g COMPLETED successfully") ; } }
      I was unable to detect a question or request in your post, so it is difficult to guess what you expect in response.

      You seem to have ignored the advice on avoiding the error-prone drive mapping, (writing directly to a UNC path is the recommended alternative).

      Your code appears to be somewhat fragile, but I suppose it could work.

              If your eyes hurt after you drink coffee, you have to take the spoon out of the cup.
                    -Norm Crosby

        Thank you for reply. I have tried to use the UNC path "\\store\projectnew$" in my script ,but script has error for "$" that is used in the UNC path. My question is that,
        1>how can use the UNC path that has $ sign at the end.
        2>I want to verify UNC path for write access to the user.
        thank you. SMW11

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1071882]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (8)
As of 2024-04-23 08:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found