Perl - Parse UNC Path in a string variable

Discussion in 'Perl Misc' started by Kevin Joseph, Aug 12, 2004.

  1. Kevin Joseph

    Kevin Joseph Guest

    I have written a Perl script to modify some files over the network.
    All PCs are Win2k. Most of the files reside on a share in the form of
    \\server\share_name. Some of the files are on dirves in the form of
    \\server\d$ and this is where my problem is.

    My script prompts the user for the file name. It store the information
    in a variable, parses it and then accesses it. If the file name
    entered is \\server\share_name\filename, I do not have a problem. With
    \\server\d$\filename however it simply fails. I have the logic to
    convert \ to \\ which is why the former works
    (\\server\share_name\filename). I tried escaping the $ (using \$) but
    that did not work. I have tried various permutations and combinations
    thus far and as a last option am sending my request to this newsgroup.

    Kindly help.

    Kevin.
    Kevin Joseph, Aug 12, 2004
    #1
    1. Advertising

  2. (Kevin Joseph) wrote in
    news::

    > I have written a Perl script to modify some files over the network.
    > All PCs are Win2k. Most of the files reside on a share in the form of
    > \\server\share_name. Some of the files are on dirves in the form of
    > \\server\d$ and this is where my problem is.
    >
    > My script prompts the user for the file name. It store the information
    > in a variable, parses it and then accesses it. If the file name
    > entered is \\server\share_name\filename, I do not have a problem. With
    > \\server\d$\filename however it simply fails. I have the logic to
    > convert \ to \\ which is why the former works
    > (\\server\share_name\filename). I tried escaping the $ (using \$) but
    > that did not work. I have tried various permutations and combinations
    > thus far and as a last option am sending my request to this newsgroup.
    >
    > Kindly help.


    Kindly provide some useful information then. You indicate that you
    'parse' the variable, that you have the 'logic' to convert \ to \\ etc
    but never show code. We are not mind readers here. Please read

    http://www.catb.org/~esr/faqs/smart-questions.html

    to learn how to formulate your question so others can understand and help
    you. Smart questions get answers. 'Does not work' doesn't.

    --
    A. Sinan Unur
    d
    (remove '.invalid' and reverse each component for email address)
    A. Sinan Unur, Aug 12, 2004
    #2
    1. Advertising

  3. Kevin Joseph

    Kevin Joseph Guest

    Is this a Perl newsgroup or a newsgroup for someone from KinderGarden
    or it is that you are trying to market some web page for dummies ? I
    think I will just ignore your comment and wait for others to answer.

    Kevin.
    Kevin Joseph, Aug 13, 2004
    #3
  4. Kevin Joseph wrote:
    > A. Sinan Unur wrote:
    >> Kindly provide some useful information then. You indicate that
    >> you 'parse' the variable, that you have the 'logic' to convert \
    >> to \\ etc but never show code. We are not mind readers here.
    >> Please read
    >>
    >> http://www.catb.org/~esr/faqs/smart-questions.html
    >>
    >> to learn how to formulate your question so others can understand
    >> and help you. Smart questions get answers. 'Does not work'
    >> doesn't.

    >
    > Is this a Perl newsgroup or a newsgroup for someone from
    > KinderGarden or it is that you are trying to market some web page
    > for dummies ? I think I will just ignore your comment and wait for
    > others to answer.


    With that attitude, you're likely on your own.

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
    Gunnar Hjalmarsson, Aug 13, 2004
    #4
  5. Kevin Joseph

    Matt Garrish Guest

    "Kevin Joseph" <> wrote in message
    news:...
    >
    > My script prompts the user for the file name. It store the information
    > in a variable, parses it and then accesses it. If the file name
    > entered is \\server\share_name\filename, I do not have a problem. With
    > \\server\d$\filename however it simply fails. I have the logic to
    > convert \ to \\ which is why the former works
    > (\\server\share_name\filename). I tried escaping the $ (using \$) but
    > that did not work. I have tried various permutations and combinations
    > thus far and as a last option am sending my request to this newsgroup.
    >


    Since you don't even post what the actual failure message is, let alone
    working code that demonstrates the problem, you shouldn't be surprised
    you're not getting any help.

    Matt
    Matt Garrish, Aug 13, 2004
    #5
  6. [ Please do not post to comp.lang.perl.
    It was removed many years ago.
    ]


    Kevin Joseph <> wrote:

    > I have written a Perl script



    Can we see the relevant parts of it?

    I am pressing my forehead against the monitor...

    ....

    .... it is just not coming through.

    Debugging unseen code is too hard for me. :)

    Sorry.


    > It store the information
    > in a variable, parses it and then accesses it.

    ^^^^


    Huh?

    How do you parse it without accessing it first?

    What does "parse" mean when you say it?



    > I tried escaping the $ (using \$)


    > I have tried various permutations and combinations



    Show us what you have tried and we can help you fix it.

    As it is, you are the only one who can see what instructions
    have been issued to the computer, so you are the only one
    who can analyse the instructions that have been issued...


    > thus far and as a last option am sending my request to this newsgroup.



    Good. That is how it is supposed to be.

    Try everything you can think of first, post to Usenet only after
    everything else fails.

    Thank you.


    Unfortunately you have not given us enough information to
    be able to help you.

    Have you seen the Posting Guidelines that are posted here frequently?


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
    Tad McClellan, Aug 13, 2004
    #6
  7. [ Please do not post to comp.lang.perl.
    It was removed many years ago.
    ]

    Kevin Joseph <> wrote:

    > Is this a Perl newsgroup or a newsgroup for someone from KinderGarden



    In article <>,
    (Larry Wall) wrote: ...

    [snip] I view a programming language as a place to be
    explored, like Disneyland. You don't need to have a lot of preparation
    to explore a theme park. You do have to go along with the crowd
    control measures, though. In a sense, each ride has its own
    prerequisites--if you cut in line, you risk getting tossed out of the
    park.

    What we have here in this newsgroup is a failure in crowd control.
    Reading the FAQ is like staying in line--it's something you should
    learn in kindergarten. Usenet needs a better kindergarten.


    > or it is that you are trying to market some web page for dummies ?



    You come into a foreign society and start calling the regular
    members names?

    How bold.


    You "took cuts" in line (perhaps without even knowing it).

    You should expect that folks will be annoyed by that.


    > I
    > think I will just ignore your comment



    That is your choice.

    My choice is to make a killfile entry for you.

    I am now sorry that I took you seriously and took time to try
    and help you, but its already written now, so I'll just move on.

    So long and good luck with your Perl problems.


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
    Tad McClellan, Aug 13, 2004
    #7
  8. Kevin Joseph

    Anno Siegel Guest

    Kevin Joseph <> wrote in comp.lang.perl.misc:
    > Is this a Perl newsgroup or a newsgroup for someone from KinderGarden
    > or it is that you are trying to market some web page for dummies ? I
    > think I will just ignore your comment and wait for others to answer.


    Good luck then.

    Anno
    Anno Siegel, Aug 13, 2004
    #8
  9. Kevin Joseph

    Joe Smith Guest

    Kevin Joseph wrote:

    > Is this a Perl newsgroup or a newsgroup for someone from KinderGarden
    > or it is that you are trying to market some web page for dummies ?


    It was a serious request for more information in order to help you
    solve your problem.

    >>> I have the logic to convert \ to \\ which is why the former works
    >>> (\\server\share_name\filename).


    Could you show us your logic? It might need a bit of a rework.

    >>> I tried escaping the $ (using \$) but
    >>> that did not work. I have tried various permutations and combinations
    >>> thus far and as a last option am sending my request to this newsgroup.


    Could you show us which permutations and combinations you've tried so far?

    > Kindly provide some useful information then. You indicate that you
    > 'parse' the variable, that you have the 'logic' to convert \ to \\ etc
    > but never show code. We are not mind readers here.


    In other words, show us the actual code you've tried so far.
    -Joe
    Joe Smith, Aug 13, 2004
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kevin Joseph
    Replies:
    5
    Views:
    4,325
    Joe Smith
    Aug 13, 2004
  2. =?Utf-8?B?RGVhbiBNY0NhcnRlbg==?=

    Retrieving UNC Path of Mapped Drives on Client Machine

    =?Utf-8?B?RGVhbiBNY0NhcnRlbg==?=, Apr 30, 2004, in forum: ASP .Net
    Replies:
    7
    Views:
    5,571
    =?Utf-8?B?RGVhbiBNY0NhcnRlbg==?=
    May 20, 2004
  3. George Nevsky
    Replies:
    1
    Views:
    2,811
    Natty Gur
    May 16, 2004
  4. ksr
    Replies:
    5
    Views:
    7,811
    jcadow
    Feb 15, 2011
  5. Replies:
    19
    Views:
    1,091
    Daniel Vallstrom
    Mar 15, 2005
Loading...

Share This Page