There is no number for a directory length, but my format string shows it as 0. How to solve the problem in the shortest and smart way? I suspect also, that I should display zero for empty files. metadata.is_dir() is already stored in some variable.
I wouldn't hide the size of an empty file. It really should be shown as 0, since logically that's what it is. A directory, on the other hand, doesn't really have a size of its own.
So I'd just use a simple if is_dir {...} else {...} instead of trying to overengineer it.
Also, you can use write!(dir, ...) instead of dir. push_str(&format!(...)); it's tidier and much more efficient.
I tried created(), acessed(), and modified() results, and the former gives the best match, but still not exact. My theory that Windows apples DST hour accordingly when the file was modified, but my code to all timestamps regardless when they happened. I intentionally do not apply sorting, but leading blank in a day number probably should be eliminated.