5

I need to get the creation time 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 have read similar questions (Determine file creation date in Java) and 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?

Community
  • 1
  • 1
Ivan
  • 1,477
  • 3
  • 18
  • 36
  • I asked in Oracle forums and it is a bug in Java 7. I submitted it to java 7 bug database. – Ivan Jun 16 '13 at 11:35

1 Answers1

0

No sure why , but are you seeing the same time stamp for all of these :

System.out.println("creationTime: " + attr.creationTime());
System.out.println("lastAccessTime: " + attr.lastAccessTime());
System.out.println("lastModifiedTime: " + attr.lastModifiedTime());
sreeprasad
  • 3,242
  • 3
  • 27
  • 33