xaav
xaav

Reputation: 7916

capturing temporary file creation in a specific folder

I am attempting to monitor a program that may create and quickly delete files in a temporary folder. Is there a program or existing script that would monitor the creation of these files and copy them to another location so that I could view their contents? The files exist for too short of a time for me to copy them manually.

Upvotes: 2

Views: 1287

Answers (1)

Ashim Paul
Ashim Paul

Reputation: 100

@echo off 
setlocal enableDelayedExpansion 
set CHECKDIR=C:\Temp\Check
set TARGETDIR=C:\Temp\Backup

pushd %CHECKDIR%

:loop

  for /f "delims=" %%f in ('dir /b /a-d-h-s') do (

    echo "Copying %TARGETDIR%\%%f"
    copy %%f %TARGETDIR%\%%f
  )

goto loop

popd

Upvotes: 4

Related Questions