Perl - Parse UNC Path in a string variable

K

Kevin Joseph

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.
 
A

A. Sinan Unur

(e-mail address removed) (Kevin Joseph) wrote in
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.
 
K

Kevin Joseph

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.
 
M

Matt Garrish

Kevin Joseph said:
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
 
A

Anno Siegel

Kevin Joseph said:
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
 
J

Joe Smith

Kevin said:
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.

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

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top