Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

1 Answer 1

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.