MaheshVarma
MaheshVarma

Reputation: 2125

Get last modified user of a file and creator user in Java

I know that we can get lastModified date for a file using File.lastModified() but I am not sure if there is a way i can get the username who modified the file and who created the file?

Because we have a server that everyone in the team has access. So we are planning to build a program that gives us a list of usernames who created the file and who modified the file last time.

This is on Windows OS.

Upvotes: 2

Views: 2048

Answers (1)

eckes
eckes

Reputation: 10423

You can get a whole lot of additional File attributes with the java.nio classes, especially the Files utility class which has Files.getOwner() or can retrieve a PosixFileAttributeView.

Note that I think most filesystems have only the notion of a owner, not a creator/last modifier.

Upvotes: 4

Related Questions