Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Directory.CreateDirectory followed by Directory.Move

Reply
Thread Tools

Directory.CreateDirectory followed by Directory.Move

 
 
Matt MacDonald
Guest
Posts: n/a
 
      01-30-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.MapPat h(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

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
Stylesheets are not followed after migration =?Utf-8?B?QW5kcmU=?= ASP .Net 6 04-13-2006 08:28 PM
Compiler warning: Non-exernalized string literal; it should be followed by //$NON-NLS-<n> Rhino Java 14 12-14-2005 08:55 AM
org.kxml.parser.XmlParser$DefaultParserException: Attribute name ressmust be followed by '='! @8:1764 Fahad Java 0 11-16-2005 02:52 PM
should query string followed by a file name? jrefactors@hotmail.com Java 1 08-12-2005 10:48 PM
REGEX for CUSIP followed by two numbers. Brent ASP .Net 1 07-28-2005 01:52 AM



Advertisments