且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

同步Windows文件夹

更新时间:2023-09-30 08:38:10

幸运的是,Windows中有一个有用的小程序,名为 robocopy ,该程序随Win7和Windows 7一起提供。

Fortunately, there is a useful little program in Windows called robocopy that ships with Win7 and above.

https: //technet.microsoft.com/zh-CN/library/cc733145.aspx

robocopy <source> <destination> /mir /copyall

这是您可以用来将源目录复制到目标目录,包括所有子目录,文件和元数据。它是单向的,因此不会同时检查两种方式,但是可以在Windows启动任务中设置基于时间和基于更改的触发器,以便可以在进行文件夹同步时自动进行同步工作。

This is what you can use to copy a source directory to a target directory including all subdirectories, files, and metadata. It's uni-directional so won't check both ways, but there are time and change based triggers you can set with a windows startup task so you can make the folders auto-sync as you work.

如果您阅读链接,则会找到 / mot: / mon:标记将监视文件夹的更改/等待一定的时间,然后再次复制。

If you read the link, you'll find the /mot: and /mon: flags which will watch the folders for changes/wait a certain amount of time then copy again.

此外,它确实擅长记录输出,并且在使用时非常出色作为系统启动过程。

In addition, it is really good at logging output, and is excellent when used as a system startup process.