为ListView中放置的文件创建一个文件夹
将 ListView
中的文件发送到文件夹的过程是什么。
我需要将 ListView
中的所有文件放置到按钮单击事件的文件夹中。单击按钮后,它应该为列表视图中的所有文件创建一个文件夹并将它们发送进去。
我在 C# 中使用 Winforms。
Whats the procedure to send the files placed in a ListView
to a folder.
I need to place all the files in the ListView
to a folder on button click event. On button click it should make a folder for all the files in the list view and send them in.
I'm using Winforms in C#.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用Directory.CreateDirectory方法创建文件夹。
然后使用 FileStream 类在该文件夹中创建新文件。
将文件的内容/数据从数据库复制到文件流
完成后关闭文件流。
对每个文件重复 2-4。
Use Directory.CreateDirectory Method to create a folder.
Then use FileStream class to create new file in that folder.
Copy the contents/data of the file from database to the file stream
When finished close the file stream.
Repeat 2-4 for each file.
要检查目录是否存在,请使用 Directory.Exists 方法。
要创建目录(如果不存在),请使用 Directory.CreateDirectory 方法。
要获取目录中的所有文件,请使用 Directory.GetFiles 方法(字符串、字符串) 。
要移动文件,请使用 File.Move 方法 。
要复制文件,请使用 文件。复制方法
To check if the directory exists, use Directory.Exists Method .
To create the directory if it does not exist, use Directory.CreateDirectory Method.
To get all files in a directory, use Directory.GetFiles Method (String, String).
To move files, use File.Move Method .
To copy files, use File.Copy Method