Submitted On 17-JAN-2000
hmorgenstern
this is an important and obvious feature to have access to. There should be
such low level access to the file attributes including access to setting all
other file attributes not currently available
Submitted On 26-JUN-2001
sk33sk33
I just started programming with java - and I am shocked
about this matter!!!! I tried(!?) to program a FTP Client
(which should set the archive flag after upload).
no help at all?!?
Submitted On 17-MAY-2006
cowwoc
Any idea why this method wasn't added alongside Mustang's setReadable(), setWriteable() and setExecutable()?
Submitted On 20-JAN-2008
amclay
I would like to see a filesystem class that would read data from the filesystem. Then we could implement other code much more efficiently and easily.
Submitted On 21-JAN-2008
PasiM
Definitely yes! This should have been in File class since Java 1.0
Even though I wouldn't implement it same way than mentioned in this bug/rfe description. Instead, File class should have non-static method setHidden(boolean) that would work exactly like setReadable(boolean), setWritable(boolean) and setExecutable(boolean) which already exists. Method setHidden(boolean) would return false in case OS doesn't support setting files hidden or it can not be done to current file.
This already happens with setReadable(false) and setExecutable(false) methods in Windows systems. Windows doesn't support 'readable' and 'executable' flags like Unix, therefore it does nothing to file and returns false. Same way setHidden(boolean) would return false in Unix.
Ok, now someone is saying that Unix does support hidden files. Yes, but changing file to hidden would change file name, causing several problems. Ok, now someone is saying that setHidden(boolean) returning false in Unix is not correct, because hidden files are supported after all. Fine, let's change method name to setHiddenFlag(boolean) or setHiddenAttribute(boolean) then. This way method name is already telling that it's exactly _the 'hidden' flag of the file_ we want to change, if it's just possible.
I really do not understand why this kind of basic file function still isn't in Java :-( If there's just some simple reason why not, please let me know too...
Submitted On 13-FEB-2008
PolianaINATEL
Hi.. Itīs so simple ..
To create a hidden file on windows platforms using java you need to use runtime..
Example:
File arquivo = new File("Example.txt");
arquivo.createNewFile();
String comando = "C:\\WINDOWS\\System32\\ATTRIB.EXE +H Example.txt";
Runtime.getRuntime().exec(comando );
Submitted On 19-FEB-2008
PasiM
PolianaINATEL: True and I'm actually used that in one program which I was sure that will be used only in windows.
However, that would pretty much lose idea of Java programs being platform independent. Even I used windows as example, there might be other platforms too which support hidden flag and it would be nice if programs would work on those too.
There's also risk that running command "attrib" could in some systems do something else than set file attributes. Unlikely, but possible. So I do not see using Runtime.exec() very good general and/or long term solution to this.
Thanks for commenting though :-)
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|