除非我遗漏了一些东西,最简单的方法是使用xcopy(假设你在Windows上实际上是指.bat文件):
xcopy <SOURCE> <DEST> /e /d /y /h /r /c
Run Code Online (Sandbox Code Playgroud)
解释这些标志:
/e: Include directories and sub directories even if empty
/d: Only copy files which have changed on SOURCE more recently than DEST
/y: Suppress prompts
/h: Also copy hidden and system files
/r: Override read-only files (e.g. ignore Read Only flag)
/c: Continue even if there are errors
Run Code Online (Sandbox Code Playgroud)
来源:我的标准备份脚本,每天运行6年.