Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: How to get full path name in windows?

by CountZero (Bishop)
on Dec 09, 2012 at 18:52 UTC ( #1007998=note: print w/ replies, xml ) Need Help??

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

Even on Windows the forward slash in filepaths works. That saves you a lot of escaping.

use Modern::Perl; my $dirname = 'c:/data/eps'; opendir( DIR, $dirname ); my @files = readdir(DIR); foreach my $file (@files) { my $file_path = "$dirname/$file"; say "File path: $file_path"; } closedir DIR;
File path: c:/data/eps/. File path: c:/data/eps/.. File path: c:/data/eps/agrafort.jpg File path: c:/data/eps/alazif File path: c:/data/eps/ARF.jpg File path: c:/data/eps/ARF.png ...
For anything more complicated than a simple list of all files in a directory, File::Find::Rule is something to think about (and it gives you the full file path).


A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

My blog: Imperial Deltronics

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

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (9)
As of 2015-11-27 10:16 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (723 votes), past polls