Print Directory Listing to a csv file

If you have a whole load of music albums on your hard drive and want to print a listing of those you have:
dir -C -1 -N -R /music/ > music-listing.csv

This effectively uses the dir command with the options:

-C <- this allows the results to be formatted into columns, useful for our csv (comma seperated values) file

-1 <- this ensures only one entry per line

-N <- this removes any ‘\ ‘ characters, linux users know what I mean

-R <- this recursively lists the contents of each folder

/musc/ <- this is your folder location

> music.csv <- this is the output file, which the results are stored in

This will give a nice csv file, ready to be opened in OpenOffice or Micro$oft Excel.

It nicely lists the folders at the top and then the music tracks in the relevant recursive section below.

Something like this:

/mnt/western/Music Library/Various Artists/R&B Classics (disc 3):
01 Nelly – Dilemma (feat. Kelly Rowland).mp3
02 Blackstreet – No Diggity (feat. Dr. Dre).mp3
03 R. Kelly – Bump ‘N’ Grind.mp3
04 Aaliyah – Back & Forth.mp3
05 Fugees – Fu-Gee-La.mp3
06 Eve – Let Me Blow Ya Mind (feat. Gwen Stefani).mp3
07 Foxy Brown – Get Me Home (feat. Blackstreet).mp3
08 Next – Too Close.mp3
09 Mary Mary – Shackles (Praise You).mp3
10 Boyz II Men – I’ll Make love To You.mp3
11 India.Arie – Brown Skin.mp3
12 702 – Where My Girls At.mp3
13 Horace Brown – Things We Do for Love (feat. Jay-Z) (Eddie F’s Paradise mix).mp3
14 Erykah Badu – On & On.mp3
15 Solange – Feelin’ You, Part 1 (feat. Slim Thug).mp3
16 Dru Hill – In My Bed (So So Def remix).mp3
17 Jodeci – Freek ‘N You.mp3
18 Toni Braxton – You’re Makin’ Me High.mp3
19 Ginuwine – Pony.mp3
20 Alicia Keys – You Don’t Know My Name.mp3
cover.jpg

Advertisements

2 thoughts on “Print Directory Listing to a csv file

  1. It is easy for you to use a tool rather den using this codes, because when i was print directory listings i use a tool called Print Directory.

    Find Here : www(.)print-directory(.)com

    Like

Post a comment

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s