title: batch script - run command on each file in directory
body: <p>I need to convert some xls files into xlsx files. I can successfully convert one xls file into xlsx by running this command into cmd prompt (windows):</p>
  
  <pre><code>ssconvert inputFileName.xls outputFileName.xlsx
  </code></pre>
  
  <p>(ssconvert is a Gnumeric's command-line utility that can convert between different spreadsheet file formats)</p>
  
  <p>I'd like to write a batch file that FOR EACH file in a specified directory runs the command I wrote above, using the current file name both for input and for output filename.</p>
  
  <p>For example, if I have this set of files:</p>
  
  <pre><code>c:\directory\file1.xls
  c:\directory\file2.xls
  c:\directory\file3.xls
  </code></pre>
  
  <p>the output should be</p>
  
  <pre><code>c:\directory\file1.xlsx
  c:\directory\file2.xlsx
  c:\directory\file3.xlsx
  </code></pre>
  
  <p>so the batch pseudo code should be something like</p>
  
  <pre><code>directory = c:\directory\
  for (fileName in directory)
      ssconvert fileName.xls fileName.xlsx
  </code></pre>
  
  <p>Can anyone help me?</p>