# Need help in copying XML files from FTP (a) to FTP (b)

**URL:** <https://connective.celigo.com/t/need-help-in-copying-xml-files-from-ftp-a-to-ftp-b/344>\
**Category:** Integrator.io\
**Tags:** ftp, error-handling, file-transfer, xml, flow-builder\
**Created:** [September 28, 2023, 7:31pm UTC](https://connective.celigo.com/t/need-help-in-copying-xml-files-from-ftp-a-to-ftp-b/344 "2023-09-28T19:31:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![raulbernales](https://avatars.discourse-cdn.com/v4/letter/r/db5fbb/32.png) [@raulbernales](https://connective.celigo.com/u/raulbernales)\
**Post date:** [September 28, 2023, 7:31pm UTC](https://connective.celigo.com/t/need-help-in-copying-xml-files-from-ftp-a-to-ftp-b/344/1 "2023-09-28T19:31:21Z")

</div>

Good day. We are trying to create a flow to copy XML files from our clients FTP server to our FTP server and we can't seem to make it work.

Below is the flow that we are working on.

 ![5301043caa20740200000001-781f7a9532e44340928dac6a05e145c2.png](https://us1.discourse-cdn.com/flex001/uploads/celigo/original/2X/6/60c720da5028febeb13be256b21e30ba5ca122fd.png)

Here are the parameters set on source FTP

 ![5301043caa20740200000001-8793357979f7404995af2c83e2625a35.png](https://us1.discourse-cdn.com/flex001/uploads/celigo/original/2X/5/567a86954bb879a536e23f9d92675cc0c8098929.png)

Here are the parameters set on destination FTP

 ![5301043caa20740200000001-e107a47187e443dc9a30f1db93394f23.png](https://us1.discourse-cdn.com/flex001/uploads/celigo/original/2X/0/0fe3755aabadbe5fedea1d0bea9bd3a106e4097f.png)

And below are the errors that we are getting.

 ![5301043caa20740200000001-7de67fe37d2a4c6fb4e01f1732fbfa57.png](https://us1.discourse-cdn.com/flex001/uploads/celigo/original/2X/a/af3cbab3ce35f980192803d84b11a3178367d255.png)

Would appreciate any advice. Thanks!

---

<div class="post-metadata">

**Author:** ![youssefzouhairi](https://sea1.discourse-cdn.com/flex001/user_avatar/connective.celigo.com/youssefzouhairi/32/7087_2.png) [@youssefzouhairi](https://connective.celigo.com/u/youssefzouhairi)\
**Post date:** [September 28, 2023, 8:34pm UTC](https://connective.celigo.com/t/need-help-in-copying-xml-files-from-ftp-a-to-ftp-b/344/2 "2023-09-28T20:34:53Z")

</div>

Hi Raul,   
In your import, do you have the blobKey in the advanced section ?

 ![5301043caa20740200000001-65c385ab467f4b20bfe093e4a9b011ee.png](https://us1.discourse-cdn.com/flex001/uploads/celigo/original/2X/7/7374e331d2517abedb004b6c021a08290c72999e.png)

If not , please try to add the value “blobKey” for Blob path and retry.   
  
Youssef

---

<div class="post-metadata">

**Author:** ![raulbernales](https://avatars.discourse-cdn.com/v4/letter/r/db5fbb/32.png) [@raulbernales](https://connective.celigo.com/u/raulbernales)\
**Post date:** [September 29, 2023, 1:58pm UTC](https://connective.celigo.com/t/need-help-in-copying-xml-files-from-ftp-a-to-ftp-b/344/3 "2023-09-29T13:58:56Z")

</div>

Hi @youssefzouhairi, I've tried that one but unfortunately I'm still getting the same error below:

```
Message: HTTP Status 500 – Internal Server Errorbody {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}HTTP Status 500 – Internal Server ErrorType Exception Report
```

---

<div class="post-metadata">

**Author:** ![youssefzouhairi](https://sea1.discourse-cdn.com/flex001/user_avatar/connective.celigo.com/youssefzouhairi/32/7087_2.png) [@youssefzouhairi](https://connective.celigo.com/u/youssefzouhairi)\
**Post date:** [September 29, 2023, 2:06pm UTC](https://connective.celigo.com/t/need-help-in-copying-xml-files-from-ftp-a-to-ftp-b/344/4 "2023-09-29T14:06:00Z")

</div>

@raulbernales  
It seems that the issue is in the destination server. I tried the same configuration as yours in my account and it works.   
Try to create a flow with as Export , some csv that you parse, and then as Import, you re-create the csv and deposit the file in the server. That's the way I would troubleshoot it.   
This is to be sure it's not a blob issue and confirm that the connection to the distant server works correctly.

---

<div class="post-metadata">

**Author:** ![raulbernales](https://avatars.discourse-cdn.com/v4/letter/r/db5fbb/32.png) [@raulbernales](https://connective.celigo.com/u/raulbernales)\
**Post date:** [October 10, 2023, 3:03pm UTC](https://connective.celigo.com/t/need-help-in-copying-xml-files-from-ftp-a-to-ftp-b/344/5 "2023-10-10T15:03:04Z")

</div>

@youssefzouhairi

We've advanced a bit by changing the File name handlebar expression from {{{record.fileName}}} to SHIPMENT-{{timestamp "YYYY-MM-DD hh:mm:ss" "America/Chicago"}}.XML

 ![5301043caa20740200000001-03d4abbcf87a4012ba25691b1a1cbe50.png](https://us1.discourse-cdn.com/flex001/uploads/celigo/original/2X/0/0717bedbc6617faf321075484ce9e5edd5fece9d.png)

Any chance anyone can help provide the correct handlebar expression to use the exact filename of the source XML file(s). Below are samples of the source XML filenames.

- SHIPMENT\_498522\_20230928102300160837.xml
- SHIPMENT\_498524\_20230928102300166780.xml
- SHIPMENT\_497519\_20230928102300142041.xml

Many thanks in advance!

---

<div class="post-metadata">

**Author:** ![raulbernales](https://avatars.discourse-cdn.com/v4/letter/r/db5fbb/32.png) [@raulbernales](https://connective.celigo.com/u/raulbernales)\
**Post date:** [October 15, 2023, 3:54pm UTC](https://connective.celigo.com/t/need-help-in-copying-xml-files-from-ftp-a-to-ftp-b/344/6 "2023-10-15T15:54:15Z")

</div>

Finally was able to make it work to get the exact filename by reading the article [Get the file name and size of FTP exports](https://docs.celigo.com/hc/en-us/articles/4406438887579-Get-the-file-name-and-size-of-FTP-exports). I used the preSavePage function shared by @kathyanaqueeman below so the handlebar expression {{record.fileName}} can work.

```
function preSavePage (options) {// sample code that simply passes on what has been exportedif(options.data &&options.data.length>0){for(let i =0; i <options.data.length; i++) {options.data[i].fileName=options.files[i].fileMeta.fileName;
 options.data[i].fileSize=options.files[i].fileMeta.fileSize;
   }
  }

return {  
data: options.data,  
errors: options.errors,  
abort: false,  
newErrorsAndRetryData:   
}  
}
```
