Page 1 of 1

Copy all files that are created till 10 mins back

Posted: 28 Oct 2009 23:24
by gsenthilkumar
Hi,
I need a Windows batch script, which copies all files from a folder, that are written till 10 minutes before (by checking with the system time) to another folder.

Could anyone help me plz?

Thanks
Senthil

Posted: 31 Oct 2009 08:54
by X-Zat
Well...
I can give you some advices but not any help.

I would try this:

1. First, create a script that checks all files and writes them down (with all attributes like time and date of creation) into a *.txt-file.

2. Now create a script that compares the files' time with your system time and writes chosen files down into another *.txt-file.

3. The last step is easy: Create a file that reads the second *.txt-file and automaticalls xcopies them to a destination folder

or

3.a Let the second script add a line to the third script:

Code: Select all

echo xcopy %file% %destination%>>thirdbatch.bat


while the third batch includes

Code: Select all

@echo off
title blablabla
:precheck
if exist secondtxt-file.txt echo Begin Copying now!
if exist secondtxt-file.txt goto checklist
if not exist secondtxt-file.txt goto error
:error
echo blablabla
:checklist
REM Here will be the entries made by the second batch!


As I said, I do not know if this could help you - This is not very complicated, it's simple.

Bye, X-Zat[/code]