You can see I'm not exactly a group veteran from my formatting skills.
I want to direct thanks to Alan Bahm for the general shell open code, and
ami for the open last idea.
No sorting needed, just maximum.
I find the functions below useful when working from REPL. This is my
.juliarc file. I tried to add documentation metadata to the function, but
it does not work with version checks.
println(".juliarc define function: lastfile() ")
"""
Name of last file
Perhaps
first(sort(map(f -> (realpath(f), unix2datetime(stat(f).mtime)),
readdir()), by = t -> last(t), rev=true))
would do if there's no better way.
copy-pasted the above and noticed:
a) works nicely!
b) needs a `using Dates` or `Dates.unix2datetime` to work on my 0.4 release.
c) `t -> last(t)` could be just `last`
On Saturday, October 24, 2015 at 11:43:28 AM UTC+3, cormu...@mac.com wrote:
>
> Perhaps
>
> first(sort(map(f ->
Works great, the function mtime is exactly what I needed.
One more syntax shortening: mtime(f) works as good as stat(f).mtime. That's
the function I needed.
A last remark, if I want to look for the last modified file of a directory
different from the working directory, this function fails: