Sometimes you may need to get a sorted list of all files in a direcoty transformed in a database format, so, after getting the directory list you may end cutting and pasting the data to your database. On the other hand, there's an easy way to do that, if you just follow this tip. Open Terminal and type:
ls -lT | \
awk '{print "\""$10"\""";""\""$6" "$7", "$9"\""";""\""$5"\""}' \
| pbcopy
This will generate a CSV (comma-delimited) directory listing on the clipboard in the following format:
"Filename";"Creation Date";"Size"
For example:
"a2p";"Mar 21, 2005";"104608"
"aclocal";"Mar 20, 2005";"12606"
"aclocal-1.6";"Mar 20, 2005";"12606"
"addftinfo";"Mar 20, 2005";"59852"
"afmtodit";"Mar 20, 2005";"165346"
"alias";"Mar 21, 2005";"147"
"appleping";"Mar 21, 2005";"19656"
If you want to generate a file instead of sending the result to the clipboard, just replace the | pbcopy part with > xxx, where xxx is the file name you want to create.
Mac OS X Hints
http://hints.macworld.com/article.php?story=20060829114722873