Wouter
Wouter

Reputation: 2653

how to set a file's lastModifiedDate?

For my app I want to keep track of which files have been accessed most recently (for cache management: files used least are first to go out).

Now Android doesn't appear to have a last accessed date function for files, so I'm looking at the next best thing: file.lastModifiedDate(). That gives me the last modified date, which is effectively the creation date.

But when accessing the file I'd like to set this value to the current time. Like Linux's touch command. How can I do this, without actually modifying the file?

Upvotes: 0

Views: 989

Answers (1)

Related Questions