# Check If file exists - functionGlobalContext

**URL:** https://discourse.nodered.org/t/check-if-file-exists-functionglobalcontext/60507
**Category:** General
**Tags:** function-node
**Created:** [29 March 2022 18:51 UTC](https://discourse.nodered.org/t/check-if-file-exists-functionglobalcontext/60507 "2022-03-29T18:51:50Z")
**Posts on this page:** 1
**Showing post:** 7

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [31 March 2022 18:59 UTC](https://discourse.nodered.org/t/check-if-file-exists-functionglobalcontext/60507/7 "2022-03-31T18:59:55Z")

</div>

This may help:

> [@Select files within a date range and merge them into one file](https://discourse.nodered.org/t/select-files-within-a-date-range-and-merge-them-into-one-file/59701/8):
>
> Here is another way to do it grinning Using just a function node. [image] You can use fs instead of fs-extra if you like but then you will end up with a more complex first line of the for block. fx-extra is used by Node-RED by the way. I'm using fast-glob here instead of using the fs-ops node. // Use Fast-Glob to get the list of files const entries = await fg(['\*/csv/\*.csv']) msg.entries = entries // get the files msg.files = [] let fline for (const fname of entries) { let f = await f…

---

_[View the full topic](https://discourse.nodered.org/t/check-if-file-exists-functionglobalcontext/60507)._
