2

From the following quote taken from the javadoc.

FileTime creationTime() Returns the creation time. The creation time is the time that the file was created. If the file system implementation does not support a time stamp to indicate the time when the file was created then this method returns an implementation specific default value, typically the last-modified-time or a FileTime representing the epoch (1970-01-01T00:00:00Z).

Returns: a FileTime representing the time the file was created

I get the last-modified-time instead of the creation time. Is anybody else, having ubuntu 11.10, confirming that actually the Ubuntu 11.10 file system does not implement that function? Thanks in advance.

Rollerball
  • 12,618
  • 23
  • 92
  • 161
  • already answered here: http://stackoverflow.com/questions/3813541/is-there-a-way-to-know-the-creation-time-of-a-file-in-ubuntu – Rollerball May 06 '13 at 16:07

1 Answers1

2

This depends on the filesystem, ext3 doesn't store the creation time. Ext4 does have a field 'crtime' that holds this information. ext4 has been the default filesystem in Ubuntu since 9.10, so you probably have a ext4 filesystem.

edit: Ok, apparently on Unix filesystems you cannot retrieve the creation timestamp, you simply get a copy of the last modification time.

In UnixFileAttributes.java:

@Override
public FileTime creationTime() {
    return lastModifiedTime();
}
Jasper Krijgsman
  • 1,018
  • 11
  • 13