I have tried using the below code to get the file creation time of a file in linux system. But instead of giving the creation time , it is giving last modified time. Please help me to get the file creation time in java for linux file system.
File f=new File("/var/fileName.csv");
Path p = f.toPath();
BasicFileAttributes attr = Files.readAttributes(p, BasicFileAttributes.class);
System.out.println("creationTime: " + attr.creationTime().toInstant().atZone(ZoneId.systemDefault()));
Thanks in advance!!
statxsyscall manually since there's no glibc wrapper function for it. Not surprising if the jre you're using doesn't support that.