Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: How to get full path name in windows?

by bart (Canon)
on Dec 10, 2012 at 12:47 UTC ( #1008094=note: print w/ replies, xml ) Need Help??


in reply to How to get full path name in windows?

If you're just interested in "*.txt" files in one directory, I recommend to forego using readdir and friends, and go straight to glob.

@txt_files = glob qq("C:\\Users\\Me\\Desktop\\Cluster1\\*.txt");

Unlike readdir, glob returns the full path in the same format as you passed as an argument: absolute path in yields absolute path out; relative path in (relative to the current working directory of perl which you can change with chdir) yields relative path out.

Note that if (and only if) your $dirname contains spaces, then the double quotes are required. You don't have to put them around the whole path-with-wildcards, replacing every single space with qq(" ") will work, too.


Comment on Re: How to get full path name in windows?
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2015-07-02 06:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (29 votes), past polls