System.IO.Directory.GetFiles(folSong, "*.mp3").ToList<string>()
.Where(f => new Regex(@"(_\d{1,})", RegexOptions.None).IsMatch(Path.GetFileName(f)) ||
new Regex(@"^(\d{1,})[\s\.-]{1,}", RegexOptions.None).IsMatch(Path.GetFileName(f)))
.ToList<string>()
.ForEach(_f =>
{
string __f = folSong + "\\" +
new Regex(@"^(\d{1,})[\s\.-]{1,}", RegexOptions.None).Replace(
new Regex(@"(_\d{1,})", RegexOptions.None).Replace(Path.GetFileName(_f), ""),"");
this.Invoke(new Action(() => this.Text = "Check File:" + _f));
if (!System.IO.File.Exists(__f))
{
System.IO.File.Move(_f, __f);
}
else
{
//check file size ....
long a = new FileInfo(_f).Length;
long b = new FileInfo(__f).Length;
if (a >= b - 0.3 * b && a <= b + 0.3 * b)
System.IO.File.Delete(_f);
}
});