开发者

Make a folder for the files placed in ListView

开发者 https://www.devze.com 2022-12-22 03:21 出处:网络
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 al

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 W开发者_StackOverflow社区informs in C#.


  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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号