• We should now be fully online following an overnight outage. Apologies for any inconvenience, we do not expect there to be any further issues.

Is it possible to import a Unix directory into an Excel spreadsheet

Arkitech

Diamond Member
Apr 13, 2000
8,356
4
76
Does anyone know if it's possible to import a Unix directory into an Excel spreadsheet?

I'm trying to create a report based on about several thousand files within a Unix server directory, I was thinking if I could import the directory into a spreadsheet it would be easier to sort the data based on whatever criteria I needed. (dates, file size, etc..) Unfortunately I'm a ultra-newb when it comes to Unix, I know a few basic commands but very little on data sorting. Thanks for any suggestions
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
ls -l > directory.csv
csv opens in excel

Except that it won't open properly because it's not comma seperated. He would need to go through the data import stuff to get everything in columns like he wants it.
 

Drakkon

Diamond Member
Aug 14, 2001
8,401
1
0
Originally posted by: Nothinman
ls -l > directory.csv
csv opens in excel

Except that it won't open properly because it's not comma seperated. He would need to go through the data import stuff to get everything in columns like he wants it.
yeah but i dont think theres anyway around having to import it in some way....
 

notfred

Lifer
Feb 12, 2001
38,241
4
0
Originally posted by: Nothinman
ls -l > directory.csv
csv opens in excel

Except that it won't open properly because it's not comma seperated. He would need to go through the data import stuff to get everything in columns like he wants it.

Ok, then:
ls -l | perl -nle "s/\s+/,/g;print" > file.csv
 

Arkitech

Diamond Member
Apr 13, 2000
8,356
4
76
Thanks for all the info guys, Notfred you are the man.


One more newb question, I'm pulling the directory info from a root I don't have access to so I can't save any files there. How do I save the output either to my home directory or to my hard drive (if that's even possible)
 

notfred

Lifer
Feb 12, 2001
38,241
4
0
just use the full path:

ls -l | perl -nle "s/\s+/,/g;print" > /home/wherever/file.csv