WatchDirectory Forum
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl
watchDirectory forums >> Plugins >> Need a Plugin
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl?num=1145539005

Message started by Newone on Apr 20th, 2006 at 3:16pm

Title: Need a Plugin
Post by Newone on Apr 20th, 2006 at 3:16pm
Hi!
Need a plugin!!! If txt file contains a word "MONEY" then save it in to folder "MONEY"; if "abc" then into "abc"

Best!

Title: Re: Need a Plugin
Post by Gert on Apr 20th, 2006 at 4:53pm
Hi,

I am not sure what you mean.
Is it, if the file has a name like themoney.txt or if the contents of the file has the word money somewhere?

Gert

Title: Re: Need a Plugin
Post by Newone on Apr 20th, 2006 at 7:46pm
Hi!
Yes - if the contents of the file has the word money somewhere. There is a soft, writing log files 001.txt, 002.txt, 003.txt..... and I need to send them to different e-mails.
Sorry about my english.


Title: Re: Need a Plugin
Post by Gert on Apr 20th, 2006 at 8:14pm
Your english is fine, I just wanted to make sure what you requested.

copy the following code and save it as automove.bat using a text-editor (notepad).

[code]
GOTO %WD_REASON%

:FILENEW
:FILECHNG

SET SEARCHFOR=money
SET TARGET=D:\Testing\targ\Money
Call :FindIt
if %RESULT% EQU FOUND GOTO :EOF

SET SEARCHFOR=dollar
SET TARGET=D:\Testing\targ\Dollar
Call :FindIt
if %RESULT% EQU FOUND GOTO :EOF

SET SEARCHFOR=abc
SET TARGET=D:\Testing\targ\abc
Call :FindIt
if %RESULT% EQU FOUND GOTO :EOF

rem all other files are moved to "other"
MD "D:\Testing\Other"
MOVE "%WD_FILE%" "D:\Testing\Other"
GOTO :EOF

:FindIt
SET RESULT=NOTFOUND
FINDSTR /I /C:"%SEARCHFOR%" "%WD_FILE%"
if %ERRORLEVEL% equ 1 GOTO :EOF

MD "%TARGET%"
MOVE "%WD_FILE%" "%TARGET%"
SET RESULT=FOUND

GOTO :EOF


:FILEDEL
:FILEREN
:DIRNEW
:DIRDEL
:DIRREN
:QUIET
[/code]

The above .bat file will check every new file for
money - moves to d:\testing\targ\money
dollar - moves to d:\testing\targ\dollar
abc - moves to d:\testing\targ\abc
all other files are moved to d:\testing\targ\other

Use the automatically run a batch script plugin to run the above automove.bat for new and changed files ( http://www.watchdirectory.net/wdhelp/help/wdnewconfigpage4.html ).
That should do the trick.

Gert

Title: Re: Need a Plugin
Post by Newone on Apr 20th, 2006 at 9:11pm
GREAT!
Working!!!
Thank You!
Really good!

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