Make a folder for the files placed in ListView
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#.
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.
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
精彩评论