NorthReptile
asked on
read and filter directory contents
I use the following code to read a list of contents from a directory
[code]
@files = <$in/*>;
foreach (@files) {
}
[/code]
I know it's easy to filter one file type by placing the extension after the * but I would like to filter a list of file types but cannot figure out how to do it.
i.e. filter a list of picture files (jpg, gif, psd, etc).
[code]
@files = <$in/*>;
foreach (@files) {
}
[/code]
I know it's easy to filter one file type by placing the extension after the * but I would like to filter a list of file types but cannot figure out how to do it.
i.e. filter a list of picture files (jpg, gif, psd, etc).
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks, Ozo's solution was exactly what I was after. I am sure the grep works just as fine too but i prefer the syntax of the other.
thanks to you both.
thanks to you both.
Note, that second solution is case sensitive.
Open in new window