[Script-Fu] case sensitive file-glob

Let’s talk again about script-fu. file-glob is a beautiful function that retrieve all the files within a specified directory with the specified pattern. But if you have to deal with case sensitive file system, soon or late you’ll bump in the problem that *.jpg is different from *.JPG.

In order to solve this it’s enough to think about regular expression. Yes, it seems that file-glob make use of regular expression for file pattern matching. So if you, for example, have a patter like /home/edivad/img/*.jpg and want a case insensitive matching you can use a pattern like /home/edivad/img/*.[jJ][pP][gG].

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s