# Should I use a split node or a loop?

**URL:** <https://discourse.nodered.org/t/should-i-use-a-split-node-or-a-loop/34922>\
**Category:** General\
**Created:** [28 October 2020 03:45 UTC](https://discourse.nodered.org/t/should-i-use-a-split-node-or-a-loop/34922 "2020-10-28T03:45:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![minhhn0205](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/minhhn0205/32/29062_2.png) [@minhhn0205](https://discourse.nodered.org/u/minhhn0205)\
**Post date:** [28 October 2020 03:45 UTC](https://discourse.nodered.org/t/should-i-use-a-split-node-or-a-loop/34922/1 "2020-10-28T03:45:59Z")

</div>

Hi,  
I have a folder (\*C:\Temp\Data\*) containing zip files, in each zip file there will be many csv files

![split-or-loop-1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/c/ac2722b65843154596068b33b50dc5a892d1e0ab.png)

For each zip file I need to extract, then check if the csv files inside it are properly or incorrectly formatted.

I used the `split` node to split each zip file for processing:

 ![split-or-loop-2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/9/b98a46b5c7476808396b1501cc3a751f394ecc38.png)

In case the csv file is set permission can not read, when reading the CSV file to check its information an exception will occur, at this point the node-red application is terminated without processing the next zip file.

I want when processing each zip file, assuming the **Data\_0002.zip** file has an exception, will continue to process the **Data\_0003.zip file** , not end the node-red application, use the `split` node as currently possible do this? Or do I have to use a `loop`?

When the exception occurred, I used the `catch` node handle to get an error, with the `loop` I know how to continue processing the **Data\_0003.zip** file, but for the `split` node I don't know how ...

Please tell me.  
Thanks!

---

<div class="post-metadata">

**Author:** ![michaelblight](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/michaelblight/32/445_2.png) [@michaelblight](https://discourse.nodered.org/u/michaelblight)\
**Post date:** [28 October 2020 05:51 UTC](https://discourse.nodered.org/t/should-i-use-a-split-node-or-a-loop/34922/2 "2020-10-28T05:51:08Z")

</div>

The exception should not kill the whole NR application. It should kill that message, independently of any others. If it's terminating NR, turning it into a loop won't make any difference. What error are you getting?

---

<div class="post-metadata">

**Author:** ![minhhn0205](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/minhhn0205/32/29062_2.png) [@minhhn0205](https://discourse.nodered.org/u/minhhn0205)\
**Post date:** [28 October 2020 07:04 UTC](https://discourse.nodered.org/t/should-i-use-a-split-node-or-a-loop/34922/3 "2020-10-28T07:04:25Z")

</div>

> [@michaelblight](#):
>
> The exception should not kill the whole NR application. It should kill that message, independently of any others. If it's terminating NR, turning it into a loop won't make any difference.

I got it.  
Thank you very much!

---

<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:** [11 November 2020 07:04 UTC](https://discourse.nodered.org/t/should-i-use-a-split-node-or-a-loop/34922/4 "2020-11-11T07:04:38Z")

</div>

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