This discussion is archived
6 Replies Latest reply: Apr 11, 2013 4:04 PM by EJP RSS

File creation time in OSX with Java 7

1000720 Newbie
Currently Being Moderated
I need to get the creation file attribute of a file on OS X Lion. I have tried with Java nio, but it returns the modification time instead:

BasicFileAttributes attr = Files.readAttributes(path, BasicFileAttributes.class);
System.out.println("Creation time: " + attr.creationTime());

I know that some file systems don't support file creation timestamps but HFSP does so shouldn't BasicFileAttributes.creationTime method return the right value on OS X?

Thanks.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points