user6762070 user6762070 - 10 months ago 70
Java Question

case-sensitive processing of file names

Looking to verify that there's no case-sensitive methods for processing file/path references.

This is for a use like looking up a file with a ".pdf" and/or ".PDF" extension in the directory without knowing whether it is upper- or lower-case.

doesn't seem to have it. the only way I can think of is checking both cases or using
at it.

is there a better way of doing this?

Answer Source

you can use external jar like apache-commons , and read file without caring of extension type or case sensitivity

String fileNameWithOutExt = FilenameUtils.removeExtension(fileNameWithExt);

There also other ways will help you there :How to get the filename without the extension in Java?