File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other JSE/JEE APIs and the fly likes how to a hide a file using java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "how to a hide a file using java" Watch "how to a hide a file using java" New topic
Author

how to a hide a file using java

kalpana
Greenhorn

Joined: Dec 28, 2000
Posts: 5
hi all1

kindly tell me how to hide any file using java, and that too without invoking any commands like attrib in MSDOS.....
pls let me know.
advance thanks
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
"kalpana",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp .
We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please choose a new name which meets the requirements.
Thanks.

Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
Hide a file from what, exactly?
If you want to hide it from everything, then you can use the delete() method of the file object! If the file is not deleted, then it will visible to whatever people or processes are allowed by the security model of the operating system.
Can you give a few more details about what you want to do, and what operating system(s) you wish it to work on?
Mirko Froehlich
Ranch Hand

Joined: Aug 21, 2000
Posts: 114
It sounds like he wants to set a file's hidden attribute so that it does not show up in directory listings unless the show hidden attribute is used. In Windows or DOS, this would mean setting the hidden attribute, and in Unix prepending a dot to the filename, since Unix does not have a real hidden file concept. In either case, I don't think there is a way to do this in Java without calling an OS-specific command (i.e. "attrib" in DOS/Windows). The File class has an isHidden() method, but there does not seem to be a setHidden() method or anything like that. This makes sense, since for example in Unix a file cannot really be hidden, at least not without renaming it, which would be an extremely bad side-effect.
-Mirko

Originally posted by Frank Carver:
Hide a file from what, exactly?
If you want to hide it from [b]everything
, then you can use the delete() method of the file object! If the file is not deleted, then it will visible to whatever people or processes are allowed by the security model of the operating system.
Can you give a few more details about what you want to do, and what operating system(s) you wish it to work on?[/B]

kalpana
Greenhorn

Joined: Dec 28, 2000
Posts: 5
thanks a lot for u'r reply.
i meant the same thing of what u explained all about.thankx.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to a hide a file using java