getfiles

Ignore folders/files when Directory.GetFiles() is denied access

I am trying to display a list of all files found in the selected directory (and optionally any subdirectories). The problem I am having is that when the GetFiles() method comes across a folder that it cannot access, it throws an exception and the process stops. How do I ignore this exception (and ignore the protected folder/file) and co...

Directory.GetFiles works, Directory.GetDirectories doesn't on the same directory

I have a simple file selector on my web application which uses Directory.GetFiles and Directory.GetDirectories to produce the UI. This works perfectly on my localhost, but when I upload it to my Windows Server 2003 hosting I can only see files - on the same directory, GetFiles works but GetDirectories doesn't. The code is incredibly si...

UnauthorizedAccessException cannot resolve Directory.GetFiles failure

Hi all, Directory.GetFiles method fails on the first encounter with a folder it has no access rights to. The method throws an UnauthorizedAccessException (which can be caught) but by the time this is done, the method has already failed/terminated. The code I am using is listed below: try { // looks in stat...

VB.NET: GetFiles Method - "Access to the path 'G:\System Volume Information' is denied."

Here is my code, Dim allFiles As FileInfo() = tempDir.GetFiles("*.pdf", SearchOption.AllDirectories) I've googled and found that I need to change the permissions of my app from Project properties > View UAC Settings > and change level to level="requireAdministrator" But its also not working. I found somethi...

Have Directory.GetFiles return one file at a time? (.NET)

Hi everyone. I have a folder with far too many files in, and I want to go through each file one by one. The problem is that Directory.GetFiles returns a completed array, and this takes too long. I would rather have an object I would point to a folder, then call a function that returns me the next file in the folder. Does .NET have a cla...

Using WindowsIdentity to get a list of files/directories in ASP.NET while logged in using Forms Authentication

Edit 6: Using Windows Integrated authentication (with an account that has access to the share and the database), I can get the list of files/directories. However, refresh the page and get an UnauthorizedAccessException. Perhaps a NetBIOS or ActiveDirectory limitation. 5 months and still no solution, other than 'use impersonation' (via P...

how to get file from a passworded area using PHP

hello I want to make a script that takes a URL to a file and will import that file to a specific folder in my web server how to request a file if it's in a passworded area, i have an account "username/password" but how can i make the request to that file ? ...

Get directory where executed code is located

I know that in the same directory where my code is being executed some files are located. I need to find them and pass to another method: MyLib.dll Target1.dll Target2.dll Foo(new[] { "..\\..\\Target1.dll", "..\\..\\Target2.dll" }); So I call System.IO.Directory.GetFiles(path, "*.dll"). But now I need to get know the path: string pa...

Looking for the best way to load list view showing thumbnail pictures of a folder.

Hi, I've got the following code files = di.GetFiles("*.jpg"); for (int i = 0; i < files.Length; i++) { il.Images.Add(System.Drawing.Image.FromFile(folder + "\\" + files[i].Name)); lv.Items.Add(files[i].Name, i); } the code fills a System.Windows.Forms.ImageList with pictures from a jpg files. it also creates a System.Windows.Fo...

GetFiles with multiple extentions

How do you filter on more than one extension? I've tried: FileInfo[] Files = dinfo.GetFiles("*.jpg;*.tiff;*.bmp"); FileInfo[] Files = dinfo.GetFiles("*.jpg,*.tiff,*.bmp"); ...

PHP - Code to traverse a directory and get all the files(images)

i want to write a page that will traverse a specified directory.... and get all the files in that directory... in my case the directory will only contain images and display the images with their links... something like this How to Do it p.s. the directory will not be user input.. it will be same directory always... ...

How to check if a specific file exists in directory or any of its subdirectories

In C#, how do I check if a specific file exists in a directory or any of its subdirectories? System.IO.File.Exists only seems to accept a single parameter with no overloads to search subdirectories. I can do it with LINQ and System.IO.Directory.GetFiles using the SearchOption.AllDirectories overload, but that seems a bit heavy han...