Page 1 of 1
Regular Expression in Copy/Move
Posted: Thu Feb 26, 2015 6:18 pm
by DMolter
Can regular expression be used in copy/move tasks?
I want to move files that are all T{date}.TXT (T20150225.TXT for example), can I define one copy/move task to move all such files?
Re: Regular Expression in Copy/Move
Posted: Fri Feb 27, 2015 11:31 am
by Oleg
Copy/move action can use only standard mask symbols
- * - any quantity of of any symbols
? - one symbol
If you want to use regular expressions you can process files in the loop and check each name by using
RegExp Match
See my example below:
Code: Select all
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|317955339
Comment=STRINGLIST
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task405"
Hide=INTEGER|0
ID=INTEGER|1593129795
LogOnAsUser=INTEGER|1
Name=STRING|"RegEx in filename"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
WriteGeneralLog=INTEGER|0
[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
[Actions\Action1]
ActionID=STRING|"A_LOOP_FILE"
Enabled=INTEGER|-1
Name=STRING|"File Loop"
Params=FOLDER
[Actions\Action1\Params]
createmode=STRING|"1"
date1=STRING|"20150227"
date2=STRING|"20150227"
destvar=STRING|"FILENAME"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"D:\incoming\t*.txt"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderHours=STRING|"1"
OlderMinutes=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
searchkind=STRING|"0"
sort=STRING|"0"
sortby=STRING|"0"
sortorder=STRING|"0"
subdirs=STRING|"0"
timesize=STRING|"0"
WithoutPath=STRING|"0"
[Actions\Action2]
ActionID=STRING|"A_REGEXP_MATCH"
Enabled=INTEGER|-1
Name=STRING|"RegExp Match"
Params=FOLDER
[Actions\Action2\Params]
anchored=STRING|"0"
case=STRING|"0"
extended=STRING|"0"
line00000000=STRING|"{ExtractFileName({filename})}"
linecount=STRING|"1"
multiline=STRING|"0"
noautocapture=STRING|"0"
pattern=STRING|"(?i)t[0-9]{8}\.txt"
savesubexpression=STRING|"0"
singleline=STRING|"0"
subexpressionpos=STRING|"0"
ungreedy=STRING|"0"
useexternal=STRING|"0"
variable=STRING|"found"
[Actions\Action3]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER
[Actions\Action3\Params]
case=STRING|"0"
operator=STRING|"0"
type=STRING|"3"
value1=STRING|"{found}"
[Actions\Action4]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""File found: {filename}"""
Params=FOLDER
[Actions\Action4\Params]
icon=STRING|"1"
msg0=STRING|"File found: {filename}"
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"
[Actions\Action5]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"
[Actions\Action6]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"