English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Only C# :

Plz, tell how to copy a folder and all its contents to other folder.

even tell me how to get the filenames and folders in a string[] array.

or even to change FileSystemInfo[] format to string[] format.

2007-07-01 03:49:35 · 1 answers · asked by Parv 2 in Computers & Internet Programming & Design

Thanks danW!, I have got the subfolders in array,

but, I also want the contents of subfolders.

I'll be thankful if you could me the code.

2007-07-01 06:30:44 · update #1

1 answers

This code should fill give you two arrays. One with the all the subfolders in a specified folders, and one with the files in a specified folder. Since I'm a VB dude, I ran this through a converter to get it to C#. My apologies if it doesn't work correctly.

using System.IO;
class Subroutines
{

public void GetFolders(string parentFolder)
{
string[] subFolders = Directory.GetDirectories(parentFolder);
//Now the subFolders array is filled with strings for all the subdirectories containted within parentFolder
}

public void GetFiles(string parentFolder)
{
string[] dirFiles = Directory.GetFiles(parentFolder);
//Now the dirFiles array is filed with strings for the paths of every files containted within parentFolder
}
}

2007-07-01 05:09:32 · answer #1 · answered by DanW 3 · 1 0

fedest.com, questions and answers