CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Get relative path from c:/users/desktop/csv/pdf/test.pdf

 



balrajswamy
Novice

Dec 16, 2015, 2:55 AM

Post #1 of 4 (1127 views)
Get relative path from c:/users/desktop/csv/pdf/test.pdf Can't Post

Hi All,

Good morning.

How to get a relative path for c:/users/desktop/csv/pdf/xxx/mm/test.pdf in perl.

Thanks in advance.


Laurent_R
Veteran / Moderator

Dec 16, 2015, 4:38 AM

Post #2 of 4 (1121 views)
Re: [balrajswamy] Get relative path from c:/users/desktop/csv/pdf/test.pdf [In reply to] Can't Post

Relative compared to what path?


balrajswamy
Novice

Dec 16, 2015, 9:24 AM

Post #3 of 4 (1108 views)
Re: [Laurent_R] Get relative path from c:/users/desktop/csv/pdf/test.pdf [In reply to] Can't Post

Hello,

For example the given the path is a abosolute to open or read this file c:/users/desktop/csv/pdf/test.pdf, here we are giving full path, where as in relative path, we can write relative path for the same file as follows something like that c:/user([a-z]*)/test.pdf. But I did not know the approach right.
Some times the relative path will be helpful than the absolute path in perl.

thanks in advance.


Laurent_R
Veteran / Moderator

Dec 16, 2015, 10:19 AM

Post #4 of 4 (1104 views)
Re: [balrajswamy] Get relative path from c:/users/desktop/csv/pdf/test.pdf [In reply to] Can't Post

Hmm, assuming you launch your program from c:/users/desktop/ (and don't change directory), your default path is c:/users/desktop/.

A relative path is then the path compared to default path. For example, the relative path for c:/users/desktop/csv/pdf/ will be ./csv/pdf/. You'll be able to view the file c:/users/desktop/csv/pdf/test.pdf by typing something like:


Code
cat ./csv/pdf/test.pdf


or even simply:

Code
cat csv/pdf/test.pdf


(But I prefer the syntax with ./, it is clearer IMHO.)

That's all basically there is to relative path.

Is that what you were looking for? I am not quite sure after having seen your example, which I don't really understand. If not, please explain.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives