Log copied files - Use as boolean / checklist

Discuss RoboTask here
Post Reply
Rukbunker
Posts: 228
Joined: Mon Feb 22, 2016 4:06 pm
Location: Netherlands

Log copied files - Use as boolean / checklist

Post by Rukbunker »

Hey Oleg,

Quite a long story why I need this, but I need to have some kind of log file in which file-paths are being written. (I have that already), now...if a file is going to be copied AND he is already in that logfile (= copied 1 time), he should skip it. What is your best practice?

Shall I play with text loops, or..?
Oleg
Site Admin
Posts: 3281
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Log copied files - Use as boolean / checklist

Post by Oleg »

You can add the file name to the end of your log in any case (Write Text File
and then sort the text, removing duplicates (see Sort Text action).
Oleg Yershov
Rukbunker
Posts: 228
Joined: Mon Feb 22, 2016 4:06 pm
Location: Netherlands

Re: Log copied files - Use as boolean / checklist

Post by Rukbunker »

That's not what I meant, or do we have a misunderstanding? ;)

Task: copy files, search in folder for *.*
File 1 found --> Check logfile
Is filepath 1 found in logfile? NO COPY, go to file 2
Is filepath 1 not found in logfile? DO COPY file 1 and add to logfile.

The old task which I've found (Search substring in text files (imported)) doesn't fullfill this. It should look in 1 textfile for a filename, not every time a {filename}.txt.
Last edited by Rukbunker on Tue Jan 20, 2026 5:06 pm, edited 1 time in total.
Oleg
Site Admin
Posts: 3281
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Log copied files - Use as boolean / checklist

Post by Oleg »

Perhaps I misunderstood you...
Do you want to avoid copying a file if it already exists in the log?
It would be better to create a table in the database. In this case, you can easily check whether a record exists in the table.
In the case of a text file, you need to use Text Loop and scan the whole file. For example, like this (see example below)

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1133661666
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task85"
Hide=INTEGER|0
ID=INTEGER|17024800
LogOnAsUser=INTEGER|1
Name=STRING|"Check exitence in the log"
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RestrictRESTAPIAccess=INTEGER|0
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
StepPause=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action10=FOLDER
Action11=FOLDER
Action12=FOLDER
Action13=FOLDER
Action14=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=FOLDER

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""_LogFile"" with value ""C:\temp\List.txt"""
Params=FOLDER

[Actions\Action1\Params]
_rt_variables_produced=STRING|"_LogFile"
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"_LogFile"
varvalue=STRING|"C:\temp\List.txt"

[Actions\Action10]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER

[Actions\Action10\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"0"
type=STRING|"3"
value1=STRING|"{_Found}"

[Actions\Action11]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"Log message (neutral) ""File exists in the log"""
Params=FOLDER

[Actions\Action11\Params]
expression=STRING|"3"
message=STRING|"File exists in the log"
mode=STRING|"0"
type=STRING|"3"

[Actions\Action12]
ActionID=STRING|"A_FLOW_ELSE"
Enabled=INTEGER|-1
Name=STRING|"Else"

[Actions\Action13]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"Log message (warning) ""File does not exist in the log"""
Params=FOLDER

[Actions\Action13\Params]
expression=STRING|"3"
message=STRING|"File does not exist in the log"
mode=STRING|"0"
type=STRING|"1"

[Actions\Action14]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"

[Actions\Action2]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""_FileName"" with value ""example.xlsx"""
Params=FOLDER

[Actions\Action2\Params]
_rt_variables_produced=STRING|"_FileName"
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"_FileName"
varvalue=STRING|"example.xlsx"

[Actions\Action3]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""_Found"" with value ""FALSE"""
Params=FOLDER

[Actions\Action3\Params]
_rt_variables_produced=STRING|"_Found"
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"_Found"
varvalue=STRING|"FALSE"

[Actions\Action4]
ActionID=STRING|"A_LOOP_TEXT"
Enabled=INTEGER|-1
Name=STRING|"Text Loop"
Params=FOLDER

[Actions\Action4\Params]
_rt_variables_produced=STRING|"_line"
delimiter_no=STRING|"0"
destvar=STRING|"_line"
file=STRING|"{_LogFile}"
linecount=STRING|"0"
quote_char=STRING|"0"
sourcetext=STRING|"0"
strict_delim=STRING|"1"

[Actions\Action5]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER

[Actions\Action5\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"0"
type=STRING|"0"
value1=STRING|"{_FileName}"
value2=STRING|"{_line}"

[Actions\Action6]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""_Found"" with value ""TRUE"""
Params=FOLDER

[Actions\Action6\Params]
_rt_variables_produced=STRING|"_Found"
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"_Found"
varvalue=STRING|"TRUE"

[Actions\Action7]
ActionID=STRING|"A_LOOP_BREAK"
Enabled=INTEGER|-1
Name=STRING|"Break"

[Actions\Action8]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"

[Actions\Action9]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
Oleg Yershov
Rukbunker
Posts: 228
Joined: Mon Feb 22, 2016 4:06 pm
Location: Netherlands

Re: Log copied files - Use as boolean / checklist

Post by Rukbunker »

Yupz, this works as it should, thanks!
Post Reply