list files with full modification date

1

I want to produce a list of files in a directory and feed it into a script to generate database entries including their creation dates. The database is Solr, so I need to be able to translate ISO 8601 yyyy-mm-ddThh:mm:ssZ format (although I don't really care if the timezone is off, it's a bit quick and dirty).

ls appears to be the obvious choice, but doesn't print the year in the creation date. And the format is weird. And it doesn't seem that I can just choose the columns I want, which is annoying.

What other tool might be more friendly to simple text processing a la Awk?

Potatoswatter

Posted 2012-05-11T03:54:34.660

Reputation: 197

Answers

1

The stat command will output the modification time like this:

$ stat -c %y somefile
2012-02-21 23:06:11.893609899 -0800

The man page describes other available output formats.

garyjohn

Posted 2012-05-11T03:54:34.660

Reputation: 29 085

1Thanks! All I needed was stat -f '%c %N' *. – Potatoswatter – 2012-05-11T04:17:32.277