Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Opening a Directory

by wog (Curate)
on Jan 19, 2002 at 01:55 UTC ( [id://139964]=note: print w/replies, xml ) Need Help??


in reply to Opening a Directory

If the directory name has a space in between, what should I do?

If you call out to a shell command using the name of the direcotry use quotes or, better, the multi-argument form of system or exec (update: oops, open doesn't have which accepts an arbitrary number of arugments. If you want to not have spaces or quotes be an issue and to capture the output of or send input to a command use open and exec's multi-argument form.) Otherwise, perl's internal functions (rmdir, mkdir, chmod, etc.) and any modules shouldn't have a problem.

And how to capture all the files under a directory?

I'd reccommend File::Find, since that'll do the recursion necessary (into subdirectories, etc.). (But you can use opendir, readdir, and closedir directly, if you really want to.)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-18 19:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found