dir

Perl - How to process every file in a directory

A common Perl FAQ is "How do I do (something) for every file in a directory?"

Here's some sample code that will show you how to loop through each file in a directory:

Ruby “glob”: How to process each file in a directory that matches a certain pattern

Here's some sample Ruby source code that shows how to do something with every file in a directory, where you only work on filenames that match a pattern you're interested in. For example, in my case I'm only interested in processing files that end with the filename extension WMA, so this first snippet of Ruby code shows how to print out the name of each file in a directory with the WMA extension: