How do I check/set for hidden files?

Alessandro A. Garbagnati

Setting a file "hidden" is a system-specific operation and, often, the way to do this is completely different depending upon the platform.

In Unix, for example, this can be done by simply renaming the file to a name that starts with the ".". As you can see, on this operating system, setting a file to hidden can be done with the renameTo() method.

On Windows, you'd have to execute a system call or use JNI to change attributes.

As far as checking goes, just call File.isHidden() to check.