I’m very new to Julia. I try to get the last updated date of a list of file, for that I use the method “mtime”. The result for some files is correct but unfortunately for many I get always that date : 1970-01-01T00:00:00
Do you know why I got this result? Is there another approach to get the date of the file?
Dates.unix2datetime(mtime(filename)) should work to get the modification date and time of a file, I think?
for many I get always that date : 1970-01-01T00:00:00
Maybe you are just passing an incorrect filename (or an incorrect path)? mtime returns 0.0 for files that don’t exist, which corresponds to the Unix epoch of January 1, 1970.
This is a good question. Linux distributions (often) provide the stat command which has -c FORMAT flag and a %W time of file birth, seconds since Epoch; 0 if unknown format specification. So I would suppose it comes from there, but calling stat -c "%W" file_that_does_not_exist returns an error in my distribution (Arch Linux), so I am not sure why this decision was taken. Maybe opening a bug report is the best decision.