# Get txt file in a URL directory and send to mysql DB

**URL:** <https://discourse.nodered.org/t/get-txt-file-in-a-url-directory-and-send-to-mysql-db/16525>\
**Category:** General\
**Created:** [9 October 2019 23:16 UTC](https://discourse.nodered.org/t/get-txt-file-in-a-url-directory-and-send-to-mysql-db/16525 "2019-10-09T23:16:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![federicobalm](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/federicobalm/32/26456_2.png) [@federicobalm](https://discourse.nodered.org/u/federicobalm)\
**Post date:** [9 October 2019 23:16 UTC](https://discourse.nodered.org/t/get-txt-file-in-a-url-directory-and-send-to-mysql-db/16525/1 "2019-10-09T23:16:17Z")

</div>

Hello, I write from Argentina and I clarify that my English is quite bad, sorry for that.  
Let's go to the important thing! ... in this web directory [http://ionos.ingv.it/Tucuman/data/](http://ionos.ingv.it/Tucuman/data/) every 20 minutes a new text file (.txt) is appearing with information that interests me to be able to store it in a db mysql and then work it.

Could you help me and tell me how I can do so that from node-red can extract every 20 minutes the information of the last file hosted?

To be able to take the information from the txt file and send it to a mysql database I made the following flow:

[{"id":"d7326c9.647d79","type":"http request","z":"a33f0c24.bb1ef","name":"","method":"GET","ret":"obj","paytoqs":false,"url":"[http://ionos.ingv.it/Tucuman/data/TUJ2O\_20192822100.txt","tls":"","persist":false,"proxy":"","authType":"basic","x":300,"y":246,"wires":[["9cea0664.0c58b8](http://ionos.ingv.it/Tucuman/data/TUJ2O_20192822100.txt%22,%22tls%22:%22%22,%22persist%22:false,%22proxy%22:%22%22,%22authType%22:%22basic%22,%22x%22:300,%22y%22:246,%22wires%22:%5B%5B%229cea0664.0c58b8)"]]}]

But what I need is that this is automated to permanently take the information from the last file hosted in the url and that it be hosted in the database I made.

I hope you could understand me well.  
Thank you

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [9 October 2019 23:30 UTC](https://discourse.nodered.org/t/get-txt-file-in-a-url-directory-and-send-to-mysql-db/16525/2 "2019-10-09T23:30:20Z")

</div>

Welcome to Node-RED.

You can guess the name of the file to download. So one way would be to

inject node - set to every 20 minutes

nodes to create filename - personally i would write this in a function node in javascript you can search for how to get dates in javascript and how to join strings in javascript

http request node - to get the file

change node to add the data for your db query

database node - depends on which database

Have a play, when you get stuck ask for help...

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [26 July 2020 20:27 UTC](https://discourse.nodered.org/t/get-txt-file-in-a-url-directory-and-send-to-mysql-db/16525/3 "2020-07-26T20:27:35Z")

</div>

Closed on 26 July 2020 20:27 UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
