I am having a problem moving a directory to a new location, specifically one I create with CreateDirectory
. Here is the code:
if (FALSE == CreateDirectory(strDestination, NULL))
{
dwError = GetLastError();
if (ERROR_ALREADY_EXISTS != dwError)
{
strError.Format("Error creating %s: %i", strDestination, dwError);
LogIt(strError);
}
}
if (FALSE == MoveFile(strSource, strDestination + strID))
{
dwError = GetLastError();
strError.Format("Error moving %s to %s: %i", strSource, strDestination + strID, dwError);
LogIt(strError);
}
However, if I manually create a directory, I am able to feed that path into this code and it works. I have compared the security settings for these two directories, and made sure they were the same, but it's still not working. Is there something I'm doing wrong with my creation code? If I leave the second parameter as NULL
, shouldn't it grant the same permissions it would when I manually create the directory?