File Attachment – read from file

In this post I will share small piece of code that I wrote long time back to  resolve a production issue. This can be considered as a small utility of sorts that can come in handy when required or can be viewed as an example eScript code to read information from file and perform certain action.

Requirement:

You can have certain files in folder that you would like to attach to a different service requests.  Service Request Number or Id (unique identifier) is part of file name. You files have following naming convention “Text – Number – Text.extension” for example

Customerattach – 1234567890 – email.msg

Customerattach – 1234567891 – picturefile.jpg

Customerattach – 1234567892 – document.doc

Solution:

The function expects 3 inputs

  1. FilePath: The path of file containing file details (Name of the files)
  2. AttachPath: The path where the actual files (attachments) are located
  3. RecordLimit: If you would like to limit

One Response to File Attachment – read from file

Leave a Reply

Contribute