C++
C++ _CopyFile拷贝文件
C++笔记之CopyFile和MoveFile的使用
string path = "D:\MY\\a.txt";
string dst = "E:\\code\\a.txt";
WCHAR buf[256];
memset(buf, 0, sizeof(buf));
MultiByteToWideChar(CP_ACP, 0, path.c_str(), strlen(path.c_str()) + 1, buf, sizeof(buf) / sizeof(buf[0]));
WCHAR dstbuf[256];
memset(dstbuf, 0, sizeof(dstbuf));
MultiByteToWideChar(CP_ACP, 0, dst.c_str(), strlen(dst.c_str()) + 1, dstbuf, sizeof(dstbuf) / sizeof(dstbuf[0]));
CopyFile(buf, dstbuf, false);
python
复制
import shutil
src="E:\\temp\\a.txt"
dst = "D:\\case\\a.txt"
shutil.copy(src,dst)
移动:
import shutil
src="E:\\temp\\a.txt"
dst = "D:\\case\\a.txt"
shutil.move(src,dst)