我正在将从rar/zip文件中提取的文件存储在一个文件夹中。
之后,我将该文件夹中的文件存储到数据库中。问题是它仅存储了文件夹中的文件,而没有子目录和其文件。
如何查找文件夹是否有子目录。
我使用以下代码。
如何获取文件夹中的文件和目录列表,并将它们保存到数据库中?
之后,我将该文件夹中的文件存储到数据库中。问题是它仅存储了文件夹中的文件,而没有子目录和其文件。
如何查找文件夹是否有子目录。
我使用以下代码。
Directory.CreateDirectory(StorageRoot + path + New_folder);
decom(StorageRoot + path + New_folder, StorageRoot + path + file.FileName);
foreach (var access_file in Directory.GetFiles(StorageRoot + path + New_folder))
{
string new_name=System.IO.Path.GetFileName(access_file);
FileInfo f = new FileInfo(StorageRoot + path + New_folder+ "/" + new_name);
int new_size = unchecked((int)f.Length);
string new_path = path + New_folder;
statuses.Add(new FilesStatus(new_name, new_size, new_path, StorageRoot, data));
}
如何获取文件夹中的文件和目录列表,并将它们保存到数据库中?