Question: I would like to recursively go through all files ending in .mp3 or .flac (case-insentive) in my `C:\Songs` directory and pass each file path as an argument to a binary file run from windows command prompt which returns a string representation of the audio fingerprint.

I then want to insert a record into a 2xn sqlite table, where n is the number of songs I have. The two fields are the filepath and the output of the command run from the windows command prompt.

I need some help getting started. I can `>>` the command line output to a flat file. I can also and insert a record into a sqlite database. However I don't know what languages I can use to pass the output from the command line directly to the sqlite table. Do you have any recommendations of languages and how to use them to achieve the desired goal?

Also - I'm using Windows 7 but I assume the routine would be same if I was using another windows os.

Answer: 
Using a batch script

```
@echo off
setlocal

pushd "C:\Songs"

REM Get the file count
for /f %%N in ('dir /b /a-d *.mp3 *.flac^|find /c /v ""') do set "cnt=%%N"
REM The file count is now in the cnt variable. I'll simply ECHO the value
echo File count = %cnt%

REM Process each file
for %%F in (*.mp3 *.flac) do (
  REM The file name is now in %%F variable

  REM Run your command - I'm assuming it only produces 1 line of output
  for /f "delims=" %%A in ('yourCommand yourArgs "%%F"') do (
    REM the command output is now in %%A

    REM Write your records. You will have to come up with the syntax here
    REM I'll simply echo the record to the screen
    echo "%%F", "%%A"
  )
)

popd

```
You *could* use a Windows batch script for this. @dbenham's answer looks like a good start if that's the approach you want to take (and I upvoted that answer).

But if you want real error checking, or you want to enhance this over time I'd recommend a real programming or scripting language. There are a lot of good choices. There are ways to use JavaScript or PHP.

Personally I write this type of code in Python and have been very happy with it. You can [launch a command, read it's stdout, etc](http://docs.python.org/2/library/subprocess.html). Plus it has support for [sqlite](http://docs.python.org/2/library/sqlite3.html) built right in.