如何在Windows中将一个文件夹中的新文件复制到另一个文件夹中?
我正在寻找一种方法,复制新的文件只从一个文件夹到另一个。这些准则是:如何在Windows中将一个文件夹中的新文件复制到另一个文件夹中?,windows,batch-file,Windows,Batch File,我正在寻找一种方法,复制新的文件只从一个文件夹到另一个。这些准则是: 没有动力地狱 没有软件,只有批处理shell 以毫秒或秒为单位的时间戳,而不是分钟 不同步。文件夹B上的文件可以删除,我只需要从文件夹A复制新文件即可 工作流程: 监视文件夹A 写入新文件,复制到文件夹B 我试过使用xcopy和robocopy,但据我所知,在这两种情况下使用时间戳都是以天为单位,而我想比较时间戳的毫秒数 XCOPY /D:mm-dd-yyyy Copy files changed o
- 没有动力地狱
- 没有软件,只有批处理shell
- 以毫秒或秒为单位的时间戳,而不是分钟
- 不同步。文件夹B上的文件可以删除,我只需要从文件夹A复制新文件即可
- 监视文件夹A
- 写入新文件,复制到文件夹B
xcopy
和robocopy
,但据我所知,在这两种情况下使用时间戳都是以天为单位,而我想比较时间戳的毫秒数
XCOPY
/D:mm-dd-yyyy
Copy files changed on or after the specified date.
If no date is given, copy only files whose
source date/time is newer than the destination time.
也许这会有帮助:-检查robocopycy的
/mon
和/mot
选项谢谢@SomeWittyUsername,但当我删除目标目录上的文件时,这将不起作用。它会将此视为更改,并重新复制旧文件。
ROBOCOPY
/minage:<n> Specifies the minimum file age (exclude files newer than n days or date).
@REM new_only.bat
CURRENT_TIME=%date%%time%
SOURCE_DIR="c:\source"
TARGET_DIR="c:\target"
:start
xcopy %SOURCE_DIR% %TARGET_DIR% /time>%CURRENT_TIME%
goto start