# A way to know If a File Exist

**URL:** <https://discourse.nodered.org/t/a-way-to-know-if-a-file-exist/14553>\
**Category:** General\
**Created:** [20 August 2019 13:58 UTC](https://discourse.nodered.org/t/a-way-to-know-if-a-file-exist/14553 "2019-08-20T13:58:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![barabba](https://avatars.discourse-cdn.com/v4/letter/b/258eb7/32.png) [@barabba](https://discourse.nodered.org/u/barabba)\
**Post date:** [20 August 2019 13:58 UTC](https://discourse.nodered.org/t/a-way-to-know-if-a-file-exist/14553/1 "2019-08-20T13:58:04Z")

</div>

Hi all  
I'm working with Node-Red version v0.18.1 on Raspian version 9.  
I would to know if there is a way to know if a file exist ad put the result in a Switch.

thanks in advance

---

<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:** [20 August 2019 14:11 UTC](https://discourse.nodered.org/t/a-way-to-know-if-a-file-exist/14553/2 "2019-08-20T14:11:07Z")

</div>

There are some filing system nodes around, check the flows site. Otherwise you can add a reference to the `fs` node library to the globals section in settings.js and then use global.get in a function. You can then use `fs` inside the function and just use the node.js functions.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [21 August 2019 21:28 UTC](https://discourse.nodered.org/t/a-way-to-know-if-a-file-exist/14553/3 "2019-08-21T21:28:35Z")

</div>

> **[node-red-contrib-fs-ops](https://flows.nodered.org/node/node-red-contrib-fs-ops)**
>
> A node-red node to perform basic file system operations.

I'm particular...

> **fs-ops-access** - Test existence and accessibility of a file or directory
