stat command in Mac OS X

4

4

I'm trying to get a formatted time output using a such command in Mac OS X 10.7.5 (in the Terminal app):

stat -f "%m" -t "%Y" "myfilename.jpg"

However, it still gives me a unixtime, not the formatted string:

1349690206

What I'm doing wrong?

Sunny Reborn Pony

Posted 2012-11-14T10:17:44.043

Reputation: 391

Answers

5

You have to add S for string output.

$ stat -f %Sm -t %Y file.txt
2012

Lri

Posted 2012-11-14T10:17:44.043

Reputation: 34 501