afroblanca
Programmer
Hello all. I'm trying to move a folder and all of its contents to a different location using Directory.Move(). However, when I try to do this, I get the following IOException :
Access to the path 'c:\lepidopterasites\MySite\content\userGenerated\articles\Cogswell-Cogs\This-is-the-original-folder\images\title\' is denied.
Here is my code :
Directory.CreateDirectory(newImagesFolder);
Directory.Move(oldTitleImageFileSystemPath, newImagesFolder);
Here are the values for the variables :
newImagesFolder : c:\lepidopterasites\MySite\content\userGenerated\articles\Cogswell-Cogs\a-new-folder-move-stuff-here\images\
oldTitleImageFileSystemPath : c:\lepidopterasites\MySite\content\userGenerated\articles\Cogswell-Cogs\This-is-the-original-folder\images\title\
The folder referenced in oldTitleImageFileSystemPath definitely exists. Furthermore, I have temporarily assigned the user "Everyone" Full Control access to the c:\lepidopterasites folder, so I know that it isn't a permissions issue. What's weird is that the exception is an IOException. In the documentation, we are given the following possible reasons for this method throwing an IOException :
1) An attempt was made to move a directory to a different volume.
2) destDirName already exists.
3) The sourceDirName and destDirName parameters refer to the same file or directory.
And I know for a fact that none of these conditions are true.
So I'm kinda stuck. Do you know why I'm getting this exception? If not, can you give me any ideas on how to troubleshoot this?
Thanks for the help.
Access to the path 'c:\lepidopterasites\MySite\content\userGenerated\articles\Cogswell-Cogs\This-is-the-original-folder\images\title\' is denied.
Here is my code :
Directory.CreateDirectory(newImagesFolder);
Directory.Move(oldTitleImageFileSystemPath, newImagesFolder);
Here are the values for the variables :
newImagesFolder : c:\lepidopterasites\MySite\content\userGenerated\articles\Cogswell-Cogs\a-new-folder-move-stuff-here\images\
oldTitleImageFileSystemPath : c:\lepidopterasites\MySite\content\userGenerated\articles\Cogswell-Cogs\This-is-the-original-folder\images\title\
The folder referenced in oldTitleImageFileSystemPath definitely exists. Furthermore, I have temporarily assigned the user "Everyone" Full Control access to the c:\lepidopterasites folder, so I know that it isn't a permissions issue. What's weird is that the exception is an IOException. In the documentation, we are given the following possible reasons for this method throwing an IOException :
1) An attempt was made to move a directory to a different volume.
2) destDirName already exists.
3) The sourceDirName and destDirName parameters refer to the same file or directory.
And I know for a fact that none of these conditions are true.
So I'm kinda stuck. Do you know why I'm getting this exception? If not, can you give me any ideas on how to troubleshoot this?
Thanks for the help.