Im coding a programm, which should read out the id3 tags of mp3 files, create a Directory named like the artist and then i want to move the mp3 files into the specific artist directory.
When im trying to Move the Mp3 file, it doesnt move it into the subfolder(named like the Artist) of my Musik Directory, which i created. I just want to Move the Mp3 files, not rename them.
here is my code:
public void moveFiles(string path, string[] title, string[] artist,string [] songs)
{//loop through the title array
for(int i=0;i<title.Length;i++)
{// no artist no name
if (artist[i] == null)
{
i += 1;
}//check if sourceFile is existing
if (File.Exists(songs[i]))
{//check if destinationFile is existing
if (File.Exists((@"C:\Musik\" + artist[i] + songs[i])))
{//if delete
File.Delete((@"C:\Musik\" + artist[i] + songs[i]));
}
else
{ //move file from songs[i](sourcePath)to (destinationPath)
File.Move(songs[i],(@"C:\Musik\" + artist[i] + songs[i]));
MessageBox.Show("Das Lied " + title[i] + " wurde erfolgreich verschoben");
}
}
else
{
MessageBox.Show(songs[i]+" does not exist!");
}
}
}
It only moves my files into the C:\Musik Directory and it's renaming my files like Artist-Song; Any help is welcome. Thanks:)