views:

24

answers:

2

whats the procedure to send the files placed in a listview to a folder.. that is... 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.. im using winforms in c#.net

A: 

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

astander
thanks sir but its general description on how to make fodlers but my issue is that i have the files in the database and im displaying them in the listview..now next step is i need to make the folder for those files in the listview and i need to have the backup for the files also..what is the method to do that??
zoya
A: 
  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.

logicnp
can u show me the sample code that will be easier for me to understand...plz show the code using listview..ie files are in the listview
zoya