Setting created timestamp of files using BasicFileAttributeView

Robert Krüger krueger at lesspain.de
Sat Mar 5 13:15:29 UTC 2016


Hi,

could anyone tell me if setting the created time of a file via
BasicFileAttributeView is not supported on OSX? I tried using the following
code snippet:

BasicFileAttributeView attributes =
Files.getFileAttributeView(Paths.get(file.getAbsolutePath()),
BasicFileAttributeView.class);
FileTime time = FileTime.fromMillis(someNewTimeInMillis);
attributes.setTimes(time, time, time);

Finder displays last modified and last opened (i.e. last accessed, I
assume) as the value specified by someNewTimeInMillis but created remains
at the old value.

Is this simply not supported on OSX and I have to use a native call to do
this?

Thanks in advance for any hint.

Robert


More information about the macosx-port-dev mailing list