This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
You can't use endsWith with regular expressions. Use matches instead:
The (?i) makes the matching case insensitive. Leave it out to have case sensitive matching. You need the leading .* because matches uses exact matching, not substring matching.
currentFile.getName().lastIndexOf('.') would return the index of the last dot, or -1 if there are no dots in the name. If you then add 1, you get the index of the first character after the last dot, or 0. Calling substring from that index on would give you either the extension, or the entire name.