WatchDirectory Forum
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl
watchDirectory forums >> How to... >> Copy Files Plug in
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl?num=1351004998

Message started by jmendoza on Oct 23rd, 2012 at 5:09pm

Title: Copy Files Plug in
Post by jmendoza on Oct 23rd, 2012 at 5:09pm
Wanted to see if there is a way for me to only trigger the task if a certain criteria in the name matches. Files are named with specific dates on the filename. I just want to capture or copy the files for the day the task is scheduled to run.

For example:

The plug in would run every morning at 8:00 a.m. So if it runs on Oct. 30th. I need all files that contain "1030" on the name to be copied everything else it should ignore.

So I guess what I am asking is can we use dynamic naming on the filter events?

Can you help? Thanks.

-Joe


Title: Re: Copy Files Plug in
Post by Gert on Oct 24th, 2012 at 9:59am
Hello Joe,

The current WD version (free upgrade, just install over your version) has the option to use a "filter script", a batch file that determines if a detected file should be ignored or not.

Here is an example that checks if the detected file starts with the current MMDD.
[code]@echo off
rem
rem this filter script (see http://www.watchdirectory.net/wdhelp/help/filter_events.html )
rem checks if the detected file (%WD_FILE_N% - see http://www.watchdirectory.net/wdhelp/plugins/wdopAutoRunBatEnv.html )
rem starts with the current month/day (MMDD).
rem

rem last 4 positions of WD_DATE (which has the current date in YYYYMMDD format)
SET MMDD=%WD_DATE:~-4%

rem first 4 positions of the detected file
SET F4=%WD_FILE_N:~0,4%

IF %MMDD% EQU %F4% GOTO :ProcessThisFile

GOTO :DoNotProcessThisFile



:ProcessThisFile
ECHO Y>"%WD_FILTERRESULT%"
GOTO :EOF

:DoNotProcessThisFile
ECHO N>"%WD_FILTERRESULT%"
GOTO :EOF

[/code]

WatchDirectory Forum » Powered by YaBB 2.5.2!
YaBB Forum Software © 2000-2017. All Rights Reserved.