PC Review


Reply
Thread Tools Rate Thread

Directory.CreateDirectory followed by Directory.Move

 
 
Matt MacDonald
Guest
Posts: n/a
 
      30th Jan 2008
Hi all,
I'm having a really frustrating problem. I have a web application that
needs to modify the directory structure of the underlying files. The
problem I'm having is that after the system creates a sub-directory in an
existing directory, and then I try to move the parent directory, I get an
access denied error. I've tried setting the resultant directory object to
nothing after creating it, among other things. I also tried running the
subs that do the directory io both from instanced object, as well as from
shared objects. Nothing seems to free the directory up except for time....
more time than I'm willing to accept. Is there anyway around this? Maybe
force garbage collection?

Here is the code snippet....

' Create the sub-directory
Dim d As DirectoryInfo =
IO.Directory.CreateDirectory(Current.Server.MapPath(Path))
d = Nothing

' And on a totally separate instance of the page, after creating the
sub-directory, move (rename) the parent directory
Dim d As New DirectoryInfo(Current.Server.MapPath(Path))
d.MoveTo(Current.Server.MapPath(newPath))
d = Nothing

There are no file conflicts that I can see, ie the destination directory
doesn't already exist, I'm not overwriting anything, etc. Once the
sub-directory is created, it inherits permissions from the parent, so that's
not the problem. This really shouldn't be a big deal, but it's got me
stumped. Any suggestions?

Thanks,
Matt


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Directory.CreateDirectory Tom Microsoft Dot NET Framework 1 26th Jul 2008 10:35 AM
Directory.CreateDirectory Tom Microsoft Dot NET 4 26th Jul 2008 10:35 AM
Directory.CreateDirectory() issue Ken Microsoft C# .NET 5 13th Nov 2007 09:34 PM
Directory.CreateDirectory() issue Ken Microsoft Dot NET Framework 1 12th Nov 2007 07:21 PM
CreateDirectory() and Directory::CreateDirectory() conflict ... H.B. Microsoft VC .NET 1 6th Jun 2005 05:34 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:12 AM.