public static List m_fileList = new List();
public static int GetDirectory(string srcPath)
{
try
{
DirectoryInfo dir = new DirectoryInfo(srcPath);
FileSystemInfo[] fileinfo = dir.GetFileSystemInfos(); //获取目录下(不包含子目录)的文件和子目录
foreach (FileSystemInfo i in fileinfo)
{
if (i is DirectoryInfo) //判断是否文件夹
{
GetDirectory(i.FullName); //递归调用复制子文件夹
}
else
{
m_fileList.Add(i.FullName);
}
}
return 0;
}
catch (Exception e)
{
return -1;
}
}
————————————————
版权声明:本文为CSDN博主「Sayesan」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/Sayesan/article/details/84340634