2

How can I retrieve the date/time of the creation of the current file (file-date-time-of-creation) on my system? The same question can arise for the size.

A related question was asked here. This is a Windows related question, but the question also arises for other OS's.

  • You can bind a key to a function that does (message "%s" (your-fn-that-returns-the-file-date-time-of-creation)). Also a question I have is if you want to do this only for buffers containing files or even for non-file buffers like *scratch*. – Kaushal Modi Feb 17 '15 at 15:14
  • @kaushalmodi Of course. Thanks. I edited the question. – Name Feb 17 '15 at 15:17
1

For the file last-modified date/time, the file last-accessed date/time, and the file last-status-change date/time, use function file-attributes. See the Elisp manual, node File Attibutes.

(It's not very clear what you are asking. You mention the date of the buffer creation, but @kaushalmodi mentions the "file-date-time-of-creation" in a comment and you seem to go along with that comment. Just what date/time are you asking about? If this is about the file, as I'm guessing, then please edit the question title and body to reflect that.)

  • Also on unix systems, I believe that the file last-status-change is the closest we can get to the file creation time. Not sure if the same will work on Windows (I have no way of testing that). – Kaushal Modi Feb 17 '15 at 15:39
  • I edited the question. Is last-status-change the same as file-date-time-of-creation? If this is the case, this answers the question. File Attibutes has a list of 11 elements. I cannot explicitly find file-date-time-of-creation. – Name Feb 17 '15 at 16:10
  • No, I don't think that file-attributes gives you the time of the file creation. Thanks for editing your question to make clear that that is what you want: file creation time. I can delete this answer, as it does not give you that, but I will leave it up for a bit, in case it helps someone. – Drew Feb 17 '15 at 23:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.