473,404 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Directory.CreateDirectory followed by Directory.Move

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
Jan 30 '08 #1
0 1477

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Chad | last post by:
I am receiving the following two errors in the code below. Both are on Line 56. error C2039: 'CreateDirectoryA' : is not a member of 'System::IO::Directory' error C2660: 'CreateDirectoryA' :...
2
by: ngposter | last post by:
Try the following code snippet: Directory.CreateDirectory(@"C:\Folder1\"); Directory.Move(@"C:\Folder1\", @"C:\Folder2\"); Directory.Delete(@"C:\Folder2\"); After executing, a C:\Folder1...
1
by: rv | last post by:
I am developing an ASP.NET website with C#, VS 2003 and Framework 1.1. For some reason every time I execute a Directory.Move command, the next command takes 10-20 seconds to execute. Has anyone...
3
by: James Coleman | last post by:
Hello, The following error is appearing when attempting to create a directory using the availale system.io methods: System.IO.DirectoryNotFoundException: Could not find a part of the path...
1
by: jojobar | last post by:
I have noticed that the Directory.Move removes the session as soon as the next Response.Redirect is done. It also appears that .Net framework constantly monitors all the directories below the root...
3
by: Karel | last post by:
Hello, I have a VB.NET application where I want to move directories over a network. I tried this with system.io.directory.move, but that doesn't work over different volumes. Has anyone a...
4
by: Janiek Buysrogge | last post by:
Hello, Maybe this has been covered in the past in this group, but I wasn't able to find any references. If it has been covered, please provide me with a link of some sort. I'm trying to...
3
by: =?Utf-8?B?UHVyZSBIZWFydA==?= | last post by:
hi i need the code to move files from directory to another directory on sam local machine or to a network path, thank you. -- Ammar S. Mitoori IT Head QIMCO Co. Tel : +9744831199 Mobile :...
4
by: Tom | last post by:
This is really weird, but I have the following code: private static readonly string mString = "tempUnzipDir" + Path.DirectorySeparatorChar; .... public static string...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.