Is there any way to get file/dir modification date?


#1

Basically, that’s it. There’s onDidChange(), but no getModifiedDate(). Is it just me, or is there no real api to get file/dir modification timestamp?

Background: I’m working on an owncloud/nextcloud/dropbox configuration synchronisation helper plugin that will tar/untar selected configuration pieces (namely all configuration and all packages).

For those eager to try, here’s my repo: https://github.com/nekromant/atom-ownsync (Don’t expect much, I’m more a linux kernel guy, that rarely does js these days. At the moment it’s linux only, but I plan to support mac and win as soon as I get all the basic stuff running).


#2

Not a direct answer to your question, but I was scripting operations for dragging image files into my app yesterday, using event.dataTransfer.files from the browser API, and that returns dates for the files. For example, on dropping a file into the window, I was able to log this information to the console:

lastModified
:
1355383067000
lastModifiedDate
:
Thu Dec 13 2012 16:17:47 GMT+0900 (KST)
name
:
“Journey-0001.jpeg"
path
:
”/path/to/Journey-0001.jpeg"
size
:
255983
type
:
“image/jpeg”

Now, I don’t know whether you might be able to leverage that in some way, or if it might set you on the right track to finding a solution, but there you go …


#3

Sounds like you may want to try out Node’s fs module. Since Atom is built on Node, it has access to all of Node’s modules as well.


#4

Thanks a ton! Looks like that was exactly just what I needed to get it working.
I’ve just published the first working version of the plugin today at atom-ownsync