GetDirectories and GetFiles
Hi All, Below is the code am trying to use. Basically, I have a a multiple folders in the main folder C:\Customers. I am getting a list of all the folders in this main folder and looping through them and writing the results of each file to the FTP site. Please note that in the SendFiles command, am using the folderNames[] array which am using to loop through. But the problem here is that GetDirectories command is giving the path instead of the exact folder names. However, I guess I'll need the path in the GetFiles command. Any thoughts on how to get this to work? String[] fileNames; String[] folderNames; folderNames = Directory.GetDirectories(@"C:\Customers\"); for (int i = 0; i <= folderNames.GetUpperBound(0); i = i + 1) { fileNames = Directory.GetFiles(folderNames[i]); myFtpConnection.SendFiles(fileNames, folderNames[i], true, true); }
September 21st, 2011 9:26pm

I think that i would use the DirectoryInfo class: DirectoryInfo dir = new DirectoryInfo (folderNames[i]); dir.Name is the name of the folder.Russel Loski, MCITP Business Intelligence Developer and Database Developer 2008
Free Windows Admin Tool Kit Click here and download it now
September 21st, 2011 9:44pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics