Today I found a small problem with the mp3 converter (mp3 converter v2.0). I 've got a lot of vod on emule and want to use mp3 to listen to it, after the conversion, I found that the file name is very short (everything on the emule is a super-long name), and I am surprised that the programmer must be very lazy and use the first one directly '. 'The name before the symbol is helpless, so I had to compile a small program and modify it in batches.
Code
Using System;
Using System. Collections. Generic;
Using System. Text;
Using System. IO;
Namespace DeleteDot
{
Class Program
{
Static void Main (string [] args)
{
String [] files = Directory. GetFiles (@ "G: \ Europe and America mtv ");
String fname = null;
Foreach (string fn in files)
{
FileInfo f = new FileInfo (fn );
Int dotSum = 0;
For (int I = 0; I <fn. Length; I ++)
{
If (fn [I] = '.')
{
DotSum ++;
}
}
Int dotDel = dotSum;
Fname = fn;
For (int I = 0; dotDel> 0; I ++)
{
If (fname [I] = '.')
{
If (dotDel! = 1)
{
Fname = fname. Remove (I, 1 );
I --;
}
DotDel --;
}
}
File. Move (fn, fname );
}
Foreach (string str in Directory. GetFiles (@ "G: \ Europe and America mtv "))
{
Console. WriteLine (str );
}
Console. ReadLine ();
}
}
}