我想使用c#
显示来自FTP的所有文件和子文件夹我该怎么办? 你可以上传代码吗?
我在树视图中尝试过从FTP导入数据。但我无法做到
我的代码:
private TreeNode CreateDirectoryNode(string root, string p)
{
var directoryNode = new TreeNode("CGT");
var directoryListing = GetDirectoryListing(path);
var directories = directoryListing.Where(d => d.IsDirectory);
var files = directoryListing.Where(d => !d.IsDirectory);
foreach (var dir in directories)
{
directoryNode.Nodes.Add(CreateDirectoryNode(dir.FullPath, dir.Name));
}
foreach (var file in files)
{
directoryNode.Nodes.Add(new TreeNode(file.Name));
}
return directoryNode;
}
仅将此代码留作此示例..您可以帮助我离开这里