Automatic CSV to TXT conversion [solved]

This was just asked on the beta mailing list so I thought I’d paste the question and answer here:

How can I automatically convert a CSV file to a .TXT extension so that Unity will treat it like a text asset?

using UnityEngine;
using UnityEditor;
using System.IO;
public class ANYoTXT : AssetPostprocessor
{

	static string[] s_extensions = new string[] {"csv"};

	
    private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromPath)
    {
        foreach(string asset in importedAssets)
        {
			
			string lowered = asset.ToLower();
			bool doConvert = false;
			string foundExt = "";
			foreach(string eachExt in s_extensions)
			{
				if(lowered.EndsWith("."+eachExt))
				{
					foundExt = eachExt;
					doConvert = true;
					break;
				}
			}
			
            if(doConvert)
			{
				if(!File.Exists(asset))
					continue;
				Debug.Log("Converting " + foundExt + " to TXT: " + asset.ToLower());
				
				string destFile = Path.GetDirectoryName(asset) + Path.DirectorySeparatorChar + Path.GetFileNameWithoutExtension(asset) + ".txt";
				//Debug.Log(asset + " -> " + destFile);
				File.Copy(asset, destFile, true);
				AssetDatabase.ImportAsset(destFile);
			}
			
			
        }

    }
}