Remove undescores from filename

Discuss RoboTask here
Post Reply
rice1973
Posts: 86
Joined: Mon Jan 04, 2010 2:38 am
Location: Netherlands
Contact:

Remove undescores from filename

Post by rice1973 »

Hi,How can i remove underscore's from a filename?Example;3621-271.20.10_3.jpgShould transform to;3621-271.20.103.jpgThe are mutiple files, with different filenames that have be changed in a specific directory.
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Remove undescores from filename

Post by Oleg »

See the example below. It removes "_" symbol from all names of files in c:\incomming folder.

;*******************************
;* RoboTask Task file         &n bsp;*
;* Do not edit in text editor! *
;*******************************

[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|839555382
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task908"
Hide=INTEGER|0
ID=INTEGER|146130647
LocalVariables=STRING|"OldFileName,NewFileName"
LogOnAsUser=INTEGER|1
Name=STRING|"remove ""_"""
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|2
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=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|"20100105"
date2=STRING|"20100105"
destvar=STRING|"OLDFILENAME"
DuringDays=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"C:\incoming\*.*"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
searchkind=STRING|"0"
subdirs=STRING|"1"
timesize=STRING|"0"
WithoutPath=STRING|"0"

[Actions\Action2]
ActionID=STRING|"A_STR_POS"
Enabled=INTEGER|-1
Name=STRING|"STR Pos"
Params=FOLDER

[Actions\Action2\Params]
case=STRING|"0"
from=STRING|"1"
search=STRING|"_"
source=STRING|"{ExtractFileName({OldFileName})}"
variable=STRING|"APos"

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

[Actions\Action3\Params]
case=STRING|"0"
operator=STRING|"3"
type=STRING|"1"
value1=STRING|"{APos}"
value2=STRING|"0"

[Actions\Action4]
ActionID=STRING|"A_STR_REPLACE"
Enabled=INTEGER|-1
Name=STRING|"STR Replace"
Params=FOLDER

[Actions\Action4\Params]
case=STRING|"0"
mode=STRING|"0"
source=STRING|"{ExtractFileName({OldFileName})}"
substring=STRING|"_"
variable=STRING|"NewFileName"

[Actions\Action5]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"Log Message"
Params=FOLDER

[Actions\Action5\Params]
message=STRING|"File {OldFileName} is renaming to {NewFileName} ..."
type=STRING|"3"

[Actions\Action6]
ActionID=STRING|"A_FILE_RENAME"
Enabled=INTEGER|-1
Name=STRING|"Rename File"
Params=FOLDER

[Actions\Action6\Params]
count=STRING|"1"
file0=STRING|"{OldFileName}"
mask=STRING|"{NewFileName}"
subdirs=STRING|"0"

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

[Actions\Action8]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
rice1973
Posts: 86
Joined: Mon Jan 04, 2010 2:38 am
Location: Netherlands
Contact:

Remove undescores from filename

Post by rice1973 »

Thnx,It wokrs.
Post Reply