为ListView中放置的文件创建一个文件夹

发布于 2024-08-23 23:25:11 字数 169 浏览 2 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

输什么也不输骨气 2024-08-30 23:25:11
  1. 使用Directory.CreateDirectory方法创建文件夹。

  2. 然后使用 FileStream 类在该文件夹中创建新文件。

  3. 将文件的内容/数据从数据库复制到文件流

  4. 完成后关闭文件流。

  5. 对每个文件重复 2-4。

  1. Use Directory.CreateDirectory Method to create a folder.

  2. Then use FileStream class to create new file in that folder.

  3. Copy the contents/data of the file from database to the file stream

  4. When finished close the file stream.

  5. Repeat 2-4 for each file.

烂人 2024-08-30 23:25:11

要检查目录是否存在,请使用 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文