Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: hide and unhide the folder in linux

  1. #1
    Junior Member
    Join Date
    Sep 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default hide and unhide the folder in linux

    Please give me a simple program to hide and unhide the folder in linux.
    I have used this program for windows.
    Runtime.getRuntime().exec("attrib -h \""+file.getAbsolutePath()+"\"");


  2. #2
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: hide and unhide the folder in linux

    Welcome to the forum.
    If you want to write it yourself, someone here will usually answer questions you have, but this is not a free code service.

  3. #3
    Senior Member PhHein's Avatar
    Join Date
    Mar 2013
    Location
    Germany
    Posts
    609
    My Mood
    Sleepy
    Thanks
    10
    Thanked 93 Times in 86 Posts

    Default Re: hide and unhide the folder in linux

    Oldie but goodie. Implement it according to this: When Runtime.exec() won't - JavaWorld

  4. #4
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: hide and unhide the folder in linux

    Linux works completely differently than Windows. To 'hide' a file, name the file beginning with a dot ('.') - the file can still be seen if the user knows how. Not sure why you wish to hide a file though...sounds a bit fishy to me.

  5. #5
    Junior Member
    Join Date
    Sep 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: hide and unhide the folder in linux

    Actually i have a tree on my UI page that containing the folder structure that is reading from file system, so i have to provide a facility to user to hide or unhide any folder from UI itself .

    so for windows i have written a code like this :- Runtime.getRuntime().exec("attrib -h \""+file.getAbsolutePath()+"\"");

    and this code is not working with linux , you suggest me to start with dot ('.') . so pls give me complete idea how to use the above code.
    please show me one example demo .


    Thanks in Advance

    Ashish kumar

  6. #6
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: hide and unhide the folder in linux

    Actually i have a tree on my UI page that containing the folder structure that is reading from file system, so i have to provide a facility to user to hide or unhide any folder from UI itself .
    Why hide via the OS rather than through the UI, which would be a much more platform independent solution. But give you haven't provided any information as to what sort of 'UI' or 'tree', we can only guess as to any recommendations

    so pls give me complete idea how to use the above code.
    please show me one example demo .
    You first. Please read post #2

Similar Threads

  1. How to create a folder with spaces written in Java under Linux?
    By mkodad in forum What's Wrong With My Code?
    Replies: 7
    Last Post: February 18th, 2013, 03:31 PM
  2. Button which suppose to hide JDialog..
    By dardam in forum AWT / Java Swing
    Replies: 3
    Last Post: April 7th, 2012, 03:55 PM
  3. how to hide jtable in jframe
    By vitiazaltair in forum AWT / Java Swing
    Replies: 2
    Last Post: February 7th, 2012, 11:12 AM
  4. Hide/Show Form?
    By chickenhawk in forum What's Wrong With My Code?
    Replies: 11
    Last Post: July 1st, 2011, 06:26 AM
  5. Replies: 1
    Last Post: June 7th, 2011, 11:53 AM

Tags for this Thread