Check if file in the log

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
timle
Pro Scripter
Posts: 96
Joined: Tue Apr 20, 2004 5:53 am

Check if file in the log

Post by timle » Tue Mar 23, 2010 10:43 pm

I try to write the files to the log,then run the script to check for files in the folder if the files already in the log, then dont process it. the script missing something may be in the "position" please help. thank you


//Check to see if it already in the logs
//Processed Log File
Let>ProcessedLog=E:\TESTFOLDER\Jumble.log

GetFileList>E:\TESTFOLDER\source\*.pdf,file_list,;
Separate>file_list,;,JumbleInbox
If>JumbleInbox_count=0,end
Let>k=0
Repeat>k
Let>k=k+1
Let>orgfile=JumbleInbox_%k%

//Get a list of folders in InFolder

//Loop through folder list

//Does this one exist in processed.log
Let>SendIt=TRUE
IfFileExists>%ProcessedLog%
ReadFile>%ProcessedLog%,ProcessedList
Position>%ogrfile%,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,%orgfile%

goto>sendToDTI
Endif
Until>k=files_count
Endif

//NOTUSE//filedate>orgfile,DateLimit
Label>sendToDTI

MoveFile>E:\TESTFOLDER\source\%orgfile%,E:\TESTFOLDER\destination\%orgfile%


until>k,JumbleInbox_count

Label>end
exit

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Wed Mar 24, 2010 1:26 am

No time for code right now, but how about this approach?

GetFileList and output to a variable/file
Use RegEx on that output to find the file name (%ogrfile% ?), will not need to separate or loop. Basically one command to get the info.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts