-
check if File Object is a system file (windows & Mac)
Hi Guys,
I'm filling a JTree with user system files/folders and I'm using the File class for this purpose.
I noticed the JTree displays also hidden & system files which will confuse the user of my application.
I first thought to use some File method & isHidden() was first candidate.I first tried
Code:
return file.isHidden()
but that's not working ..i tried
Code:
return !file.isHidden()
which seems to do better but I'm still incapable of solving this issue.
I'm planning to use Runtime.exec() but don't know what commands to use to check system & hidden files .this should take in consideration the OS windows or Mac.I think this checking should be OS centric as i guess there is No cross Platform way to solve this issue ?
am I right ? or is there any way in Java to check if a given File Object is a system file and/or a hidden file?
can some one suggest me a good and simple solution for this problem ?
thanks.
-
I'm not sure of any method to determine if a file is a system file or not. You may have to build an array of known system file type.
Also, if you're just using the methods in the File class, you may want to take a look at FileSystemView, as it might have some other handy methods you could use.
You could also create a file filter so no hidden files are returned.
Similar Threads
-
By shadowspell in forum VB Classic
Replies: 1
Last Post: 05-20-2005, 02:32 AM
-
By jase_dukerider in forum C++
Replies: 2
Last Post: 04-14-2005, 07:48 PM
-
By James Abbott in forum VB Classic
Replies: 0
Last Post: 09-30-2001, 02:11 AM
-
By Andrew McLellan in forum Java
Replies: 3
Last Post: 05-09-2001, 05:34 PM
-
By Michael Kascher in forum VB Classic
Replies: 2
Last Post: 05-31-2000, 02:48 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks