Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
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 lurking in the Monastery: (10)
As of 2014-12-26 11:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (171 votes), past polls