directoryinfo

Why isn't this DirectoryInfo comparison working?

var dirUserSelected = new DirectoryInfo(Path.GetDirectoryName("SOME PATH")); var dirWorkingFolder = new DirectoryInfo(Path.GetDirectoryName("SAME PATH AS ABOVE")); if (dirUserSelected == dirWorkingFolder) { //this is skipped } if (dirUserSelected.Equals(dirWorkingFolder)) { //this is skipped } Whilst debugging, I can examin...

Problem Moving an Image directory

I have a small application that saves images from a digital camera into disk. I generate a small bitmap preview of each folder and that is blocking me from moving the images. I tried to clear the controls containing the open images: imageList2.Dispose(); listView1.Items.Clear(); listView1.Clear(); listView1.Dispose(); nodeDirInfo.Mov...

How to select a folder relative to root in asp.net website?

I am trying to select all the files from a folder in my website and store them in a collection. The problem is that when I run the website it is not selecting the folder in my website: This is the basic structure: [Root Folder] --> [FilesFolder] Here is the code I am using: DirectoryInfo dir = new DirectoryInfo("FilesFolder"); But i...

why doesn't .net have a OOB method for copying a directory to another location?

is this the best approach? http://geekswithblogs.net/wpeck/archive/2009/09/11/directoryinfo.copyto.aspx ...

Application Settings + DirectoryInfo/FileInfo

I'm still new to C#... I'm building a WPF application and I'm trying to apply some User Application Settings. It's easy to insert standard App Settings (int, double, string, etc). I've even got something like WindowState inserted. I'd like to have a DirectoryInfo and/or FileInfo as savable settings instead of Strings. Selected type:...

DirectoryInfo.GetAccessControl throws exception "The supplied handle is invalid..."

Hi All, I am running the following lines of code (C#) on a Windows XP platform: DirectoryInfo folder = new DirectoryInfo(this.FullName); DirectorySecurity dirSecurity = folder.GetAccessControl(); where this.FullName is the C:\ folder. And I get the following exception: Exception : The supplied handle is invalid. Th...

Combine two (or more) FileInfo's...

I have something similar to this: var d1 = new DirectoryInfo(Path.Combine(source, @"bills_save." + dt)); var d2 = new DirectoryInfo(Path.Combine(source, @"reports_save." + dt)); var f1 = d1.GetFiles(); var f2 = d2.GetFiles(); I want to get, and combine, all the filenames into one FileInfo list. Would make my parsing a lot easier. C...

DirectoryInfo accessing a virtual folder

I'm trying to use DirectoryList on a virtual directory, to build up a list of files. However I get the error; URI not supported Is there an alternative to this that supports URLs? Here's my code so far..... DirectoryInfo directoryinfo = new DirectoryInfo("http://localhost:1080/mydatafolder"); IEnumerable<FileInfo> fileList = dir...

DirectoryInfo.GetFiles(searchPattern) is behaving oddly, and returning random files that DON'T match the searchPattern

I've got some old legacy code that I'm maintaining (please forgive the naming, this was written by a non programmer and the application is not important enough to be rewritten): Dim Path3 As String Path3 = "C:\Inetpub\wwwroot\uscgcrc\rsa\RSADocuments\IRBCorrespondenceToPI\" Dim dirInfo3 As New DirectoryInfo(Path3) Dim FileContainer3 A...

How can i get all files without file extension into an array.

How can i get all files without file extension into an array. I will supply the folder path. Is this possible using Directory.GetFiles() or DirectoryInfo.GetFiles()?? Is there any alternative way? I am using ASP.NET C#. ...