Folder
The Folder integrationIntegrations connect and integrate Home Assistant with your devices, services, and more. [Learn more] monitors a folder on the system running Home Assistant. It creates a sensor that shows the total size of the files in that folder, so you can, for example, get notified when a backup or recordings folder grows too large.
You can add the same folder more than once, each time with a different filter. For example, you can track the size of only the video files in a folder next to the total size of all files.
Prerequisites
The folder you want to monitor must be in the list of folders Home Assistant is allowed to access. The www folder inside your configuration folder and your media folders are allowed by default. For any other folder, add it to allowlist_external_dirs and restart Home Assistant before you add the integration.
Configuration
To add the Folder service to your Home Assistant instance, use this My button:
Manual configuration steps
If the above My button doesn’t work, you can also perform the following steps manually:
-
Browse to your Home Assistant instance.
-
In the bottom right corner, select the
Add Integration button. -
From the list, select Folder.
-
Follow the instructions on screen to complete the setup.
The full path to the folder you want to monitor, starting from the root. For example, /config or /media/recordings.
Only count files that match this pattern. For example, *.txt counts only text files. The filter uses Unix shell-style wildcards. The default is *, which counts all files except hidden files, whose names start with a dot (.).
Configuration options
You can change the filter after you add the integration. To change it, go to Settings > Devices & services, select Folder, and then select the cogwheel
Supported functionality
Each folder you add appears as a service named after the folder. For example, /media/recordings appears as recordings.
Sensors
- Size: The sensor is named after the folder and shows the total size, in megabytes (MB), of the files in the folder that match the filter.
The sensor also has the following attributes:
- Path: The path of the monitored folder.
- Filter: The filter that is applied.
- Number of files: The number of files that match the filter.
- Bytes: The total size of the matching files, in bytes.
- File list: A list of the paths of the matching files.
Data updates
The integration checks the folder every minute.
Known limitations
- The integration does not look inside subfolders automatically. Files in subfolders are only included when the filter points to them, for example
recordings/*.mp4. A subfolder that matches the filter is included in Number of files and File list, but not in the size. - Folders with a very large number of files make the File list attribute large, which can increase the size of your database.
Troubleshooting
Symptom: “Configured path is not in allowlist”
When adding the integration, the form shows the message “Configured path is not in allowlist”.
Description
Home Assistant is not allowed to access the folder you entered.
Resolution
- Add the folder to
allowlist_external_dirs. - Restart Home Assistant.
- Add the integration again.
Symptom: “Configured path is not a directory” or “Configured path is not readable”
When adding the integration, the form shows one of these messages.
Description
The path you entered does not exist, is a file instead of a folder, or Home Assistant does not have permission to read it.
Resolution
- Check that you entered the full path, starting from the root, for example
/media/recordings. - Check that the folder exists on the system running Home Assistant.
- Check that Home Assistant has permission to read the folder.
Removing the integration
This integration follows standard integration removal. No extra steps are required.
To remove an integration instance from Home Assistant
- Go to Settings > Devices & services and select the integration card.
- Next to the entry you want to remove, select the three dots
menu. Then, select Delete. - Depending on the integration, the entries are listed under one of the following headings:
- Devices
- Hubs
- Services
- Integration entries
- Depending on the integration, the entries are listed under one of the following headings:
- To confirm, select Delete.
- Home Assistant also deletes the devices and entities of the entry.
- If Home Assistant asks you to restart, restart Home Assistant.
- If Home Assistant asks whether to also delete the application credentials, select Remove or Keep.
- If you keep them, Home Assistant uses them automatically when you add the integration again.
- To delete them later, refer to Deleting application credentials.