列出所有文件在文件夹中 [英] List All Files In A Folder

查看:117
本文介绍了列出所有文件在文件夹中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要列出一个文件夹,并能够下载和使用jquery / asp.net C#中删除该文件中的所有文件(包括.DOC,.PDF,.TXT等等)。


解决方案

 的String []文件路径= Directory.GetFiles(路径,* .SQL
SearchOption.TopDirectoryOnly);

TopDirectoryOnly不包括子目录。

 的for(int i = 0; I< filePaths.Length ++ I)
     listtBox1.Items.Add(文件路径[我]);

而从这个列表框,您可以删除或将文件移动到其他文件夹中。

I need to list all the files(includes .doc, .pdf,.txt etc) in a folder and able to download and delete that file using jquery/asp.net c#.

解决方案

string[] filePaths = Directory.GetFiles(pathname, "*.sql", 
SearchOption.TopDirectoryOnly);

TopDirectoryOnly does not include subdirectory.

for (int i=0; i<filePaths.Length; ++i)
     listtBox1.Items.Add(filePaths[i]);

And from this listbox, you can either delete or move your files to another folder.

这篇关于列出所有文件在文件夹中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆