title: Writing filenames from folder in CSV in Python
body: <p>I want to write the filenames of a particular folder in a CSV file( for the purpose of bulk uploading to the Internet Archive). The CSV must be written in the prescribed format. </p>
  
  <p>I have tried the following code :</p>
  
  <pre><code>import os
  import csv
  
  path = '/media/sarada/Lectures &amp; Ebooks/Ebooks/03-Bengali Books/18.Darshan'
  
  with open('/home/sarada/ia_csv.csv', 'wb') as csvfile:
    writer = csv.writer(csvfile)
    writer.writerow(['identifier', 'file', 'description', 'subject[0]', 'title', 'creator', 'date', 'collection'])
    for dirpath, _, filenames in os.walk(path):
      if filenames:
        writer.writerow([os.path.basename(dirpath)] + filenames)
  </code></pre>
  
  <p>Now the file names are being printed in a row, i.e they are covering the <code>description</code>, <code>title</code>, <code>creator</code> etc. fields. </p>
  
  <p>The issues:</p>
  
  <ul>
  <li><p>File names should be printed in the <code>file</code> column only.</p></li>
  <li><p>How to print only the file name(stripping the extension portion) in
  <code>title</code> column?</p></li>
  <li><p>How to add a string(e.g <code>opensource</code>) in<br>
  <code>writer.writerow([os.path.basename(dirpath)] + filenames)</code> so that<br>
  the <code>creator</code> column contains that string?</p></li>
  </ul>