Code: Select all
//The incoming folder
Let>InFolder=d:\infiles
//Processed Log File
Let>ProcessedLog=d:\processed.log
//Sendmail vars
Let>server=mail.server.com
Let>[email protected]
Let>[email protected]
Let>fromname=Fred
Let>subject=New file for you
Let>body=New file for you
Label>mainloop
//Get a list of folders in InFolder
GetFileList>%InFolder%\*.*,file_list,;
Separate>file_list,;,files
//Loop through folder list
If>files_count>0
Let>k=0
Repeat>k
Let>k=k+1
Let>ThisFile=files_%k%
//Does this one exist in processed.log
Let>SendIt=TRUE
IfFileExists>ProcessedLog
ReadFile>ProcessedLog,ProcessedList
Position>ThisFile,ProcessedList,1,p
If>p>0
//This file already processed
Let>SendIt=FALSE
Endif
Endif
//Ok to process this file
If>SendIt=TRUE
//Write to processed log
WriteLn>ProcessedLog,r,ThisFile
//Send the file
SMTPSendMail>to,server,from,fromname,subject,body,ThisFile
Endif
Until>k=files_count
Endif
Wait>0.2
Goto>mainloop