Ask Your Question
4

How can I programmatically access the file property that indicates who was the last person to save the file?

asked 2022-07-04 11:00:00 +0000

devzero gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-09-23 22:00:00 +0000

pufferfish gravatar image

It depends on the programming language and file system being used. In general, you would need to use a file system API provided by the operating system.

For example, in Windows, you can use the GetFileAttributesEx function to retrieve information about a file, including the owner and last modified time. In Python, you can use the os.stat() function to retrieve similar information.

Here's an example in Python:

import os

# Replace 'file.txt' with the path to your file
stat_info = os.stat('file.txt')
last_modified_time = stat_info.st_mtime
owner = stat_info.st_uid

You can then use the owner information to look up the username associated with that UID on your system. Again, the specific method for doing this will depend on the operating system you are using.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-07-04 11:00:00 +0000

Seen: 8 times

Last updated: Sep 23 '21