日期:2014-05-17 浏览次数:20901 次
public string GetFileType(string FileDirectory)
{
DirectoryInfo DI = new DirectoryInfo(FileDirectory);
FileSystemInfo[] f = DI.GetFileSystemInfos();
string Ex="";
foreach (FileSystemInfo i in f)
{
if (i is DirectoryInfo)
{
if ((i.Attributes & FileAttributes.Hidden) == 0)
{
Search(i.FullName);
return null;
}
}
else
{
if (Ex != "")
{
Ex = i.Extension;
return Ex;
}
else
{
Ex = Ex + "," + i.Extension;
return Ex;
}
}
}
}