stat command not respecting time format options (High Sierra 10.13.6)
-
30-04-2021 - |
Pergunta
My goal is to retrieve the birth time of a file formatted to "2019-07-03" so I'm using the following which yields the following epoch time instead of the specific date format I requested:
$ stat -f "%B" -t "%Y-%m-%d" ~/Pictures/to_backup/IMG_2115.JPEG
1524428549
I get the same output if I leave out the time formatting entirely:
$ stat -f "%B" ~/Pictures/to_backup/IMG_2115.JPEG
1524428549
I read through what seemed like the pertinent parts of the strftime and stat (<- this one in particular was a face melter) man pages.
What am I missing?
Solução
You need to place a S
before B
which converts the numerals (seconds since epoch) into string output.
stat -f "%SB" -t "%Y-%m-%d" ~/Pictures/to_backup/IMG_2115.JPEG
Licenciado em: CC-BY-SA com atribuição
Não afiliado a apple.stackexchange