to move directories to different drives
-
hi, how do i move files and directories with its children, in a directory, in to another directory, in another drive? the MoveFileEx function, moves directories in same drive. but different drive ...? please help me.
Zo.Naderi-Iran
zon_cpp wrote:
MoveFileEx function, moves directories in same drive. but different drive ...?
Are you sure? The following sentence in MoveFileEx documentation[^]:
If a file is moved across volumes, MoveFileEx does not move the security descriptor with the file. The file is assigned the default security descriptor in the destination directory.
make me think you actually can. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
zon_cpp wrote:
MoveFileEx function, moves directories in same drive. but different drive ...?
Are you sure? The following sentence in MoveFileEx documentation[^]:
If a file is moved across volumes, MoveFileEx does not move the security descriptor with the file. The file is assigned the default security descriptor in the destination directory.
make me think you actually can. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
i tested MoveFileEx function. it can not move directory in different drive, with LastError = 5
Zo.Naderi-Iran
That's 'access denied' maybe your application hasn't the rights to access the source/destination folder. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
hi, how do i move files and directories with its children, in a directory, in to another directory, in another drive? the MoveFileEx function, moves directories in same drive. but different drive ...? please help me.
Zo.Naderi-Iran
thank you all. i found my solution: it is SHFiliOperation function.
SHFILEOPSTRUCT SHDirOp;
ZeroMemory(&SHDirOp, sizeof(SHFILEOPSTRUCT));
SHDirOp.hwnd = NULL;
SHDirOp.wFunc = FO_COPY;
SHDirOp.pFrom = "D:\\SourceDir\0";
SHDirOp.pTo = "C:\\DesDir\0";
SHDirOp.fFlags = FOF_MULTIDESTFILES|FOF_NOCONFIRMMKDIR|FOF_NOCONFIRMATION;if (SHFileOperation(&SHDirOp) == 0) AfxMessagBo("success");
Zo.Naderi-Iran
-
That's 'access denied' maybe your application hasn't the rights to access the source/destination folder. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]