# Monitoring a file or directory for changes using a watch node

You can monitor files or directories for changes. Whenever a monitored file or directory changes, a message indicating the change is injected into the flow.

##

When using the IoT-Gateway, please also observe the manual Controllers u-control.

1. Open Node-RED.
2. Add a watch node from the advanced category to the workspace.
3. Double-click the watch node to open the Edit watch node dialogue.
4. In the File(s) text box, specify the path to the file or directory you want to monitor (e. g. /home/admin/user).

5. External storage devices are accessible at the file path /run/media/sdxn/, where x is the device letter and n is the device specific partition number (e. g. /run/media/sda1 for the first USB flash drive). If there is only one partition, n is missing.

6. You can monitor multiple files or directories by entering a comma-separated list of file paths.

7. If you are monitoring a directory and want to monitor all its sub-directories, enable the Watch sub-directories recursively check box.
8. Click Done to apply your changes.
9. Add more nodes to the workspace and connect them to a flow with the watch node being the first node.