Batch file 批处理-超过x分钟的xcopy文件

Batch file 批处理-超过x分钟的xcopy文件,batch-file,time,copy,Batch File,Time,Copy,新文件创建时间为20分钟后,我想将扩展名为.txt的所有文件从文件夹new复制到文件夹Target。(我要复制旧文件超过20分钟) 到目前为止,看起来是这样的: set hh=%TIME:~0,2% set mm=%TIME:~3,2% set ss=%TIME:~6,2% set /a sum_sec=%hh% * 3600 + %mm% * 60 + %ss% -300 set /a h=%sum_sec% / 3600 set /a m=(%sum_sec%/60) - 60 * %h

新文件创建时间为20分钟后,我想将扩展名为
.txt
的所有文件从文件夹
new
复制到文件夹
Target
。(我要复制旧文件超过20分钟)

到目前为止,看起来是这样的:

set hh=%TIME:~0,2%
set mm=%TIME:~3,2%
set ss=%TIME:~6,2%

set /a sum_sec=%hh% * 3600 + %mm% * 60 + %ss% -300

set /a h=%sum_sec% / 3600
set /a m=(%sum_sec%/60) - 60 * %h%
set /a s=%sum_sec% - 60 * (%sum_sec%/60)
IF %h% LSS 10 set h=0%h%
IF %m% LSS 10 set m=0%m%
IF %s% LSS 10 set s=0%s%

set new_time=%h%:%m%:%s%
到目前为止,我只删除了超过20分钟的文件:

forfiles /P "C:\Users\Desktop\Start" /S /M *.txt /C "cmd /c if @ftime LSS %new_time% del /F /Q @path"
我现在的问题是如何在20分钟后将新文件从文件夹
new
复制到文件夹
Target

最佳注册表检查-它能够根据不同的时间条件筛选文件。因此(它应该位于同一目录中):

编辑。过滤txt文件

@echo off
for /f "tokens=* delims=" %%# in ('
  call FileTimeFiler.bat "New" -mm -20 -direction before -filetime created ^| findstr /e /i ".txt"
') do (
   copy "%%~f#" "Target"
)

在创造或修改的意义上更老?嗨。在创造的意义上更老。嗨。是否可以搜索并仅复制扩展名为.txt的文件?我尝试了
“C:\Users\Desktop\New\*.txt”-mm-20-direction-before-filetime-created
,但失败了,出现了运行时错误。
@echo off
for /f "tokens=* delims=" %%# in ('
  call FileTimeFiler.bat "New" -mm -20 -direction before -filetime created ^| findstr /e /i ".txt"
') do (
   copy "%%~f#" "Target"
)