MoveFileEx函数出现错误

hbxtght 2011-07-15 05:06:26
跨盘符移动文件时出现错误,GetLastError返回错误5,我查了一下,是拒绝访问的意思,在一个盘内移动没有问题,跨盘符移动的时候,移动单个文件可以成功,但是移动空目录或者非空目录都会出现错误,都是拒绝访问,应该怎么解决? 求助!
...全文
188 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
赵4老师 2011-07-15
  • 打赏
  • 举报
回复
system("cmd /c xcopy /c /h /e /r /k /y src des");
system("cmd /c rd /s /q src");//慎用

hbxtght 2011-07-15
  • 打赏
  • 举报
回复
额,3Q,那还有其他的函数可以帮我实现跨盘符移动文件夹吗[Quote=引用 1 楼 bdmh 的回复:]

网摘
The MoveFile function will move (rename) either a file or a directory (including all its children) either in the same directory or across directories. The one caveat is that the MoveFile function……
[/Quote]
至善者善之敌 2011-07-15
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 bdmh 的回复:]
网摘
The MoveFile function will move (rename) either a file or a directory (including all its children) either in the same directory or across directories. The one caveat is that the MoveFile function ……
[/Quote]

+++1
hedy007 2011-07-15
  • 打赏
  • 举报
回复
本来MoveFileEx就是移动文件的。
要移动文件夹,最方便还是xcopy
bdmh 2011-07-15
  • 打赏
  • 举报
回复
网摘
The MoveFile function will move (rename) either a file or a directory (including all its children) either in the same directory or across directories. The one caveat is that the MoveFile function will fail on directory moves when the destination is on a different volume.

70,017

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧