I want to check if a file exists in a directory or a sub-directory.
string[] filePaths = Directory.GetFiles(padserver, "*", SearchOption.AllDirectories);
try {
DataContainer.bestaatal = false;
lusfilebestaat = 0;
while (DataContainer.bestaatal == false) {
filePaths[lusfilebestaat] = Path.GetFileName(filePaths[lusfilebestaat]);
if (filePaths[lusfilebestaat] == bestandsnaam) {
DataContainer.bestaatal = true;
}
lusfilebestaat = lusfilebestaat + 1;
}
}
This works but is to slow because I have much files on my server.
Is there anyone that have a solution for this?