As the filename of the .txt file is [Songname].txt
, you can use Path.GetFilenameWithoutExtension(files[i]) to get [Songname]
. Then replace the #MP3 line with the filename + ".mp3". Now write out the file.
N.B. You will probably want to make a copy of the directory you are working on just in case something goes wrong.