I have an FTP server which stores files sent/uploaded by the client in a certain folder. The client will upload 3 files with same names but different extensions. For example,the client will send file1.ext1,file1.ext2 and file1.ext3. I am looking for a piece of code which will help me find files with same names("file1") and then zip them. Any help is appreciated. I have written this code which gets the name of all the files in the folder:
string path = "somepath";
String[] FileNames = Directory.GetFiles(path);
Use an asterisk wildcard for the File Extension in the call to GetFiles
, eg:
List<string> files = Directory.GetFiles(pathName, "SpecificFileName.*");
Or:
string[] files = Directory.GetFiles(pathName, "SpecificFileName.*");