Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Create a directory list in CSV format' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Create a directory list in CSV format
Authored by: JasonInOregon on Aug 30, '06 09:31:38AM

I found that the suggested commands work great, but that the resultant data doesn't paste well in Excel. The output file also generates well, but Excel doesn't always separate the ";" delimiter. I switched the ";" for "," (commas) and now both the clipboard data and the file generation open well in Excel.

This is what I used:
ls -lT | awk '{print "\""substr($0,index($0,$10))"\""",""\""$6" "$7", "$9"\""",""\""$5"\""}' > folderlist.csv

I also tried:
ls -lT | awk '{print "\""substr($0,index($0,$10))"\""",""\""$6" "$7", "$9"\""",""\""$5"\""}' > folderlist.txt

Nothing has gone up in smoke... yet. Someone who is more expert than I am should check this to make sure it doesn't violate some natural law of the universe or something. =)



[ Reply to This | # ]