in reply to Re: How do I read all the file names of a directory into an array?
in thread How do I read all the file names of a directory into an array?

Wow! Everyone thank you ever so much for your help, I've been learning so much! Yes, there is a chance I will find a '*' in the filenames. For some reason when I am connected to my department's server (running RedHat 7.0) and I 'ls' a directory some of the files (not all of them) have a '*' after their name. I'm not quite sure why, but I knew I needed to get rid of them to craft the link correctly for the webpage.
  • Comment on Re: Answer: How do I read all the file names of a directory into an array?

Replies are listed 'Best First'.
Re: Re: Answer: How do I read all the file names of a directory into an array?
by chipmunk (Parson) on Dec 11, 2000 at 01:55 UTC
    That's a perfect example of why you should be reading the directory listing from within Perl (i.e. the opendir/readdir solution), rather than using a non-portable external command.

    On the department's server, `ls` is aliased to `ls -F`. The -F option causes ls to add * to executables, / to directories, and @ to symbolic links. Useful when looking at a directory listing from the command prompt; not useful when getting a list of filenames within Perl.

Re: Re: Answer: How do I read all the file names of a directory into an array?
by duct_tape (Hermit) on Dec 10, 2000 at 20:45 UTC
    I believe that the reason there are *'s after some files is because ls is aliased to ls -F, which will add a * to the end of files that are executeable. It will also add some other characters onto files that are directories, symlinks, etc.... You won't run into that using readdir though. Hope this helps!

    - Brad