time - Batch - xcopy files older than x minutes -


after new file creation time of 20 min want copy files extensions .txt folder new folder target. (i want copy olny files older 20 min)

so far, looks this:

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% 

so far i've delete files older 20 minutes:

forfiles /p "c:\users\desktop\start" /s /m *.txt /c "cmd /c if @ftime lss %new_time% del /f /q @path" 

my question how can copy new files folder new folder target after 20 minutes ?

best regs

check filetimefilter.bat - capable filter files different time conditions.so (it should in same directory):

@echo off /f "tokens=* delims=" %%# in ('   call filetimefiler.bat "new" -mm -20 -direction before -filetime created ') (    copy "%%~f#" "target" ) 

edit . filter txt files

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

Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -