DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: check if File Object is a system file (windows & Mac)

  1. #1
    Join Date
    Aug 2004

    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

    return file.isHidden()

    but that's not working ..i tried

    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 ?

  2. #2
    Join Date
    Mar 2004
    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

  1. File System Object and printing reports
    By shadowspell in forum VB Classic
    Replies: 1
    Last Post: 05-20-2005, 02:32 AM
  2. wav file fade in out help
    By jase_dukerider in forum C++
    Replies: 2
    Last Post: 04-14-2005, 07:48 PM
  3. Windows File Associations
    By James Abbott in forum VB Classic
    Replies: 0
    Last Post: 09-30-2001, 02:11 AM
  4. NullPointerException when reading text file
    By Andrew McLellan in forum Java
    Replies: 3
    Last Post: 05-09-2001, 05:34 PM
  5. How do you create a file system object in vb srcipt or vb 6.0
    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
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center