WatchDirectory home page
WatchDirectory Startseite (Deutsche Version)
Site WatchDirectory (Français)
  Welcome, Guest. Please Login or Register
YaBB - Yet another Bulletin Board
   
  HomeHelpSearchLoginRegister  
 
Page Index Toggle Pages: 1
Use WD to move log files to Archive location (Read 2136 times)
jimaus
Junior Member
**
Offline



Posts: 59
Australia
Use WD to move log files to Archive location
Sep 14th, 2005 at 7:16am
 
Gert,
I would like to use WD to move log files, that are constantly updated by running apps, to a location for archive.
I would trigger WD to look at a location once a day and move the file, renaming it with a "filename_date_time.log" file name.

Is this possible?

Cheers

Jim
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2224
The Netherlands
Re: Use WD to move log files to Archive location
Reply #1 - Sep 14th, 2005 at 8:16am
 
I don't think you need to use WD for that. Just create a .bat script that does the move and "schedule" it using the AT command or "scheduled tasks" (control panel).

The script would look something like this:

@echo off
move c:\logs\thelogfile.log "d:\archive\thelogfile_%date%.log"


if you get a lot of "file in use" errors when you use the above (because other processes are writing to it), you will need a loop to retry:


@echo off
:TryAgain
move c:\logs\thelogfile.log "d:\archive\thelogfile_%date%.log"
if %errorlevel% neq 0 goto :TryAgain


Gert
Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
Page Index Toggle Pages: 1