RTT Posted May 3, 2005 Posted May 3, 2005 (edited) working with folders and files i want to create an application to search files on a server. But i don't know where to start. is there anyone who has code that he or she is willing to share? I'm searching for code to search files with a specific extension. I think to main problem is that the directory's i want to search are on an computer in the network and i should reach them as \\computername\directory\.... also i should be able to read those directory's as a specific user. So how can i read in a directory over the network while authentication with a specific username? kind regards Edited May 4, 2005 by RTT Quote
RTT Posted May 4, 2005 Author Posted May 4, 2005 I can access a directory with this code. Dim strPath As String = "\\be0001\Users\josgijsens" 'Dim strPath As String = "c:\" Dim strFile, strDir As String For Each strDir In Directory.GetDirectories(strPath) RichTextBox1.AppendText(Path.GetFileName(strDir) & vbCrLf) Next For Each strFile In Directory.GetFiles(strPath) RichTextBox1.AppendText(Path.GetFileName(strFile).ToString & vbCrLf) Next with this code i can read the directories and files on my harddisks or on an network directory "\\be0001\Users\josgijsens". My current problem is that i'm the user with rights on "\\be0001\Users\josgijsens" but if i want to view an other folder "\\be0001\Users\markwouters" i don't have the rights to is. I should be able to acces the folder as a different user. so before i try to access it i should somehow make sure that i access it not as the user that run the code but as a user given in codebased with rights to all folders. is that possible? second question. you can search a folder with GetFiles(strPath, "*.mp3") but that will only search in de current path and not in the subfolders. is there a way to search a complete map including subfolder? of will i have to write my recursive method myself? thxs Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.