umerk44
umerk44

Reputation: 2817

How to hide system protected file in you file manager

I am using File and FileSystemView classes to extract diskinfo. The problem is when i get all the files in any directory there are also the files which are system protected files and i didn't want to show them. So is there is any way to check that this is a system protected file and then don't show it?

Upvotes: 2

Views: 125

Answers (1)

Petr
Petr

Reputation: 63379

You can detect hidden files using File.isHidden() method. If you need to detect explicitly Windows system files, you can do it in Java 7 using its NIO.2 interface. See Managing Metadata in The Java Tutorials, there is an example in Section DOS File Attributes how to check for the system flag.

See also Make a File/Folder Hidden on Windows with Java

Upvotes: 3

Related Questions