# Read Files from any directory

**URL:** https://discourse.nodered.org/t/read-files-from-any-directory/54919
**Category:** General
**Created:** [9 December 2021 11:30 UTC](https://discourse.nodered.org/t/read-files-from-any-directory/54919 "2021-12-09T11:30:06Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![hanine](https://avatars.discourse-cdn.com/v4/letter/h/b4bc9f/32.png) [@hanine](https://discourse.nodered.org/u/hanine)
#### Post date: [9 December 2021 11:30 UTC](https://discourse.nodered.org/t/read-files-from-any-directory/54919/1 "2021-12-09T11:30:06Z")

</div>

How do I make node red read files from any directory not just files under the directory which it is installed in.  
Thank you in advance.

---

<div class="post-metadata">

### Author: ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)
#### Post date: [9 December 2021 11:47 UTC](https://discourse.nodered.org/t/read-files-from-any-directory/54919/2 "2021-12-09T11:47:54Z")

</div>

![Screenshot-19](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/3/93a842ff98017a750d6257bf6aefa2c6048c7d13.png)

---

<div class="post-metadata">

### Author: ![hanine](https://avatars.discourse-cdn.com/v4/letter/h/b4bc9f/32.png) [@hanine](https://discourse.nodered.org/u/hanine)
#### Post date: [9 December 2021 11:52 UTC](https://discourse.nodered.org/t/read-files-from-any-directory/54919/3 "2021-12-09T11:52:58Z")

</div>

Thank you for the reply . Do you have an idea if i can read the file path when I am choosing it from an input file?

---

<div class="post-metadata">

### Author: ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)
#### Post date: [9 December 2021 12:16 UTC](https://discourse.nodered.org/t/read-files-from-any-directory/54919/4 "2021-12-09T12:16:58Z")

</div>

Are you on Linux or Windows?

---

<div class="post-metadata">

### Author: ![hanine](https://avatars.discourse-cdn.com/v4/letter/h/b4bc9f/32.png) [@hanine](https://discourse.nodered.org/u/hanine)
#### Post date: [9 December 2021 13:01 UTC](https://discourse.nodered.org/t/read-files-from-any-directory/54919/5 "2021-12-09T13:01:33Z")

</div>

windows 10

---

<div class="post-metadata">

### Author: ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)
#### Post date: [9 December 2021 13:05 UTC](https://discourse.nodered.org/t/read-files-from-any-directory/54919/6 "2021-12-09T13:05:05Z")

</div>

The file browser should show the path to the file you select.  
For Windows you should use back slashes:

```auto
\path_to\your_file

```

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [9 December 2021 13:07 UTC](https://discourse.nodered.org/t/read-files-from-any-directory/54919/7 "2021-12-09T13:07:15Z")

</div>

The direction of the slashes should not matter - the underlying node runtime will do the right thing.

@hanine if you want to dynamically set the path the file node will read from, you can pass it in via `msg.filename`.

---

<div class="post-metadata">

### Author: ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)
#### Post date: [9 December 2021 13:08 UTC](https://discourse.nodered.org/t/read-files-from-any-directory/54919/8 "2021-12-09T13:08:10Z")

</div>

Here you go:  
[https://www.top-password.com/blog/tag/how-to-find-file-path-windows-10/](https://www.top-password.com/blog/tag/how-to-find-file-path-windows-10/)

---

<div class="post-metadata">

### Author: ![hanine](https://avatars.discourse-cdn.com/v4/letter/h/b4bc9f/32.png) [@hanine](https://discourse.nodered.org/u/hanine)
#### Post date: [9 December 2021 13:10 UTC](https://discourse.nodered.org/t/read-files-from-any-directory/54919/9 "2021-12-09T13:10:00Z")

</div>

The file name only passes the name without the path I mean in which directory the path is stored that's what i want because after that it's passed to a read file node which needs the fall path or it will go look for it under the directory which node red is installed in.

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [9 December 2021 13:31 UTC](https://discourse.nodered.org/t/read-files-from-any-directory/54919/10 "2021-12-09T13:31:56Z")

</div>

You can provide the full path to the file under `msg.filename`.

---

<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: [23 December 2021 13:32 UTC](https://discourse.nodered.org/t/read-files-from-any-directory/54919/11 "2021-12-23T13:32:49Z")

</div>

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