. 净winform
现在我得到了指定目录下的所有文件名。结果是“0001_00001523_028155.sql”
但我的目标只是得到“00001523”
我怎样才能做到这一点?
private void loadscriptfolder()
{
string folderName = this.textBoxScriptLocation.Text.Trim();
DirectoryInfo dir = new DirectoryInfo(folderName);
if (dir.Exists)
{
FileSystemInfo[] fs = dir.GetFileSystemInfos();
foreach (FileSystemInfo fs2 in fs)
{
FileInfo file = fs2 as FileInfo;
if (file != null)
{
listBoxResult.Items.Add(file);
}
}
}
}
谢谢大家!!!