Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
go ahead... be a heretic
 
PerlMonks  

Re: Listing directory contents not working (SUSE Linux issue?)...

by choroba (Abbot)
on Apr 09, 2013 at 19:45 UTC ( #1027825=note: print w/ replies, xml ) Need Help??


in reply to Listing directory contents not working (SUSE Linux issue?)...

readdir returns just the directory name, not the full path. If you are not running the script from /, your -d test looks for directories in the directory you started the script from. Prepend $dir to the directory name in the test to make it work:

elsif (-d "$dir$line") {
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ


Comment on Re: Listing directory contents not working (SUSE Linux issue?)...
Select or Download Code
Re^2: Listing directory contents not working (SUSE Linux issue?)...
by aquinom (Acolyte) on Apr 09, 2013 at 19:57 UTC
    Thanks.

      Actually, you don't need to "chomp" the values returned by readdir.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (14)
As of 2014-04-24 11:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (565 votes), past polls