# Receive file from a FTP server from multiply folder and send an email with a different subject depending on the folder

**URL:** <https://community.cdata.com/t/receive-file-from-a-ftp-server-from-multiply-folder-and-send-an-email-with-a-different-subject-depending-on-the-folder/1055>\
**Category:** CData Arc\
**Tags:** question\
**Created:** [March 17, 2025, 2:36pm UTC](https://community.cdata.com/t/receive-file-from-a-ftp-server-from-multiply-folder-and-send-an-email-with-a-different-subject-depending-on-the-folder/1055 "2025-03-17T14:36:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lansleys](https://avatars.discourse-cdn.com/v4/letter/l/e79b87/32.png) [@lansleys](https://community.cdata.com/u/lansleys)\
**Post date:** [March 17, 2025, 2:36pm UTC](https://community.cdata.com/t/receive-file-from-a-ftp-server-from-multiply-folder-and-send-an-email-with-a-different-subject-depending-on-the-folder/1055/1 "2025-03-17T14:36:29Z")

</div>

Hi All,

I’m try to setup the flow that receives file from a FTP server in multiply folders&nbsp; and then send an email with the subject containing the sub folder name. The flow I’ve&nbsp;create is as per&nbsp; below

 ![004e9f76-19f2-4dd5-af61-22e393a1f2ea.png](https://us1.discourse-cdn.com/cdata/original/1X/63bc6e393ba67d72afa3a114f03c6d6f90792d15.png)

In the&nbsp;&nbsp;Navis, a&nbsp;script, connector I’ve&nbsp;added the below script however I keep receiving&nbsp;the below message  
Formatter [subfolder\_path] failed in the evaluation of [subfolder\_path]. The error was: The value of the attribute could not be accessed: The attribute does not exist.

please can anyone guid me to a better solution or why I’m receiving the message.

arc:script  
&nbsp; \<arc:set attr=“output.header:subfolder” value=“[subfolder\_path]” /\>  
&nbsp; \<arc:set attr=“output.filepath” value=“[filepath]” /\>  
&nbsp; \<arc:set attr=“output.header:email” value=“[email\_address]” /\>  
&nbsp; \<arc:set attr=“output.header:subject” value=“[email\_subject]” /\>  
&nbsp; \<arc:push item=“output” /\>  
\</arc:script\>

---

<div class="post-metadata">

**Author:** ![TR3X](https://avatars.discourse-cdn.com/v4/letter/t/34f0e0/32.png) [@TR3X](https://community.cdata.com/u/TR3X)\
**Post date:** [March 18, 2025, 7:04am UTC](https://community.cdata.com/t/receive-file-from-a-ftp-server-from-multiply-folder-and-send-an-email-with-a-different-subject-depending-on-the-folder/1055/2 "2025-03-18T07:04:00Z")

</div>

Hi Lansleys,

Thank you for reaching out to us.

The error message suggests that the attribute **subfolder\_path** does not exist in the context where the script is being executed. This means that **subfolder\_path** &nbsp;is either not being set in the flow or is not accessible when the script runs.

When receiving a file from a File or FTP connector, a header named **RemotePath** is automatically available. This header contains the full path of the file, including its subfolder structure.

### &nbsp;

If you need the subfolder name, you can extract it from the **RemotePath** &nbsp;header instead of relying on **subfolder\_path** , which may not exist. Depending on your requirements, you can:

- Use the full&nbsp; **RemotePath** &nbsp;directly.
- Trim the path to extract only the subfolder name.

Here’s a sample script for reference:

```auto
<arc:script> <arc:set attr="output.header:subfolder" value="[_message.header:RemotePath]" /> <arc:set attr="output.filepath" value="[filepath]" /> <arc:set attr="output.header:email" value="test123@gmail.com" /> <arc:set attr="output.header:subject" value="hi" /> <arc:push item="output" /></arc:script>

```

If you need help extracting only the subfolder name, let us know how your file paths are structured, and we can assist with the correct trimming logic.

Looking forward to your response.
