Copy files, not folders ?
-
Hello, how I am able to filter directories and copy real files only ? C:\Temp\Subfolder\ C:\Temp\readme.txt (Copy only readme.txt, not the Subfolder) I am using foreach(string Element in Files) for getting all elements in a directory.
Vector7 wrote: foreach(string Element in Files) That doesn't explain very much. What is Files? A StringCollection, or what? Where did it come from? How was it created?
Do you want to know more? WDevs.com - Member's Software Directories, Blogs, FTP, Mail and Forums
-
Hello, how I am able to filter directories and copy real files only ? C:\Temp\Subfolder\ C:\Temp\readme.txt (Copy only readme.txt, not the Subfolder) I am using foreach(string Element in Files) for getting all elements in a directory.
Use the
Directory.GetFiles
method to obtain the names of files in a specific directory and afterwards copy the files by using an overload of theFile.Copy
method.