Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 1 down vote accepted

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.

share|improve this answer
    
Thanks! All I needed was stat -f '%c %N' *. – Potatoswatter May 11 '12 at 4:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .