system.io.directory

Why Can't I Inherit IO.Directory?

Why can't I create a class in VB.NET that inherits System.IO.Directory? According to Lutz Roeder, it is not declared as NotInheritable! I want to create a utility class that adds functionality to the Directory class. For instance, I want to add a Directory.Move function. Please advise and I will send you a six pack. OK nevermind I'm...

c# - Function to replicate the folder structure in the file path.

I need a simple function which will take a FileInfo and a destination_directory_name as input, get the file path from the fileinfo and replicate it in the destination_directory_name passed as the second parameter. for ex. filepath is "d:\recordings\location1\client1\job1\file1.ext the function should create the directories in the destin...

System.IO.Directory.CreateDirectory with permissions for only this current user?

Hi, I want the asp application to create a folder that has access only to the account the application was running with (i.e. asp account?) I actually wanna use this one, but I don't know how to use the "Computer\CurrentAccount" dynamically. I want to get the current working account. Thanks. ...

Directory.CreateDirectory Latency Issue?

I'm trying to create a remote directory, and then write a file to it. Every great once in a while, the application fails with a System.IO.DirectoryNotFoundException while trying to write the file. When I write the file, I'm using the returned DirectoryInfo object to help create the file path, so the application seems to think that the d...

UnauthorizedAccessException While Attempting to Change File Permissions

I trying to modify permissions programmatically using a C# windows service that is running under an administrator's account in windows XP. Another program is saving and modifying files on the local file system, in way that, after that program touches something, only the "SYSTEM" account, there after, may access it (unless I manually ch...

Prevent Windows Explorer from interfering with Directory operations.

Sometimes, no "foo" directory is left after running this code: string folder = Path.Combine(Path.GetTempPath(), "foo"); if (!Directory.Exists(folder)) Directory.CreateDirectory(folder); Process.Start(@"c:\windows\explorer.exe", folder); Thread.Sleep(TimeSpan.FromSeconds(5)); Directory.Delete(folder, false); Directory.CreateDirectory...

C# Deleting Locked Files & Folders

Hello I am writing an application that updates some drivers. However the drivers are "in use" and can't be deleted unless I restart my computer. So how can I write an application to delete these locked drivers without restarting the PC. IF Restarting MUST occur then how can I relaunch my application automatically when the computer rest...

How can I detect all the sub folders under a giving main folder?

Hello. Assume my path is "c:/myapp/mainfolder/" there are three folder included in the main folder. BTW, It doesn't need to identify separate files under mainfolder. c:/myapp/mainfolder/subfolder1/ c:/myapp/mainfolder/subfolder2/ c:/myapp/mainfolder/subfolder3/ How can I input c:/myapp/mainfoder/ and get the output: string[] subArrF...