Correction: Don't use the above ``file1.name.split('.').pop()``. It is assuming that every filename always has an extension. Instead use one of the functions from FileUtils to get the correct extension. Also convert to locale lower case before comparing the extensions.