Rename files based on contents

Discuss RoboTask here
Post Reply
DavidW
Posts: 3
Joined: Thu Aug 21, 2008 4:29 am
Location: United Kingdom

Rename files based on contents

Post by DavidW »

I want to use Robotask (v 2.2) to change a file extension based on the contents of a 'text' file.  The scenario is:
There will be several files in a directory, all called *.edi
I need to rename the files to:
*.CTI if the string "INVFIL" appears in the file, *.CTS if the string "DELHDR" appears in the file and *.CTA if the string "ACKHDR" appears in the file.
I have tried to use the {TextFile(file_name)} variable, but I am unsure as to the correct syntax of this.
Can anyone give some assistance as to how to do this?
Thanks
Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Rename files based on contents

Post by Oleg »

Variable {TextFile()} returns the content of specified file.
You can use this in "If...then" action.

Can you send me your task? my address is oleg (at) robotask.com
DavidW
Posts: 3
Joined: Thu Aug 21, 2008 4:29 am
Location: United Kingdom

Rename files based on contents

Post by DavidW »

Oleg
Many thanks for your help in solving this particular issue.
Thanks
David
Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Rename files based on contents

Post by Oleg »

I've placed the task into our examples repository. I think that this task will be interesting for other users too.
Post Reply