mardi 4 octobre 2016

folder name contain names c# Directory

I am working on Excel add-ins with intranet server.

I have names of employees and each one has a folder in the intranet and this folder may has a power point file may not. so I need to read the files for each name.

the Problem is with names: each folder name has this Pattern :

surname, firstname

but the problem is with the names who contain multiple names as a firstname or surname:

ex: samy jack sammour. the first name is: "samy jack" and the last name is "sammour"

so the folder would be : sammour, samy jack

but I have only the field name, I don't know what is the last name or the firstname(it could be "jack sammour, samy" or "sammour, samy jack"). so I tried this code to fix it:

string[] dirs = System.IO.Directory.GetFiles(@"/samy*jack*sammour/","*file*.pptx");
        if (dirs.Length > 0)
        {
            MessageBox.Show("true");

        }

but it gave me an error:

file is not illegal

how can I fix this problem and search all the possibilties

Aucun commentaire:

Enregistrer un commentaire