Hide Files & Folders
In contrast to using metadata the file or folder is completely hidden/ignored from the filetree, all APIs and cannot be accessed via URL.
Ignore patterns
Hide specific files or folders by defining ignore patterns as regular expressions.
Internally, each pattern is evaluated against the full file path using preg_match. Matching is case-insensitive. If any pattern matches, the file/folder will be hidden.
Notes:
- The path always starts with
/, which is the mounted folder. - Patterns are wrapped as
#<pattern>#iminternally. Avoid using#in patterns. The path always starts with a/, which is the mounted folder.
Examples
| Pattern | Description | Hidden | Not Hidden |
|---|---|---|---|
/\..* | Hide dotfiles like .env, .git at any depth | /foo/.bar, /.foo/bar | /foo/bar |
^/foo/.*\.txt$ | Hide everything in /foo ending with .txt | /foo/abc.txt | /foo/abc.md, /bar/foo/abc.txt |
^/node_modules/ | Hide /node_modules only at the root | /node_modules | /foo/node_modules |
/node_modules/ | Hide node_modules at any depth | /node_modules, /foo/node_modules | /node_modules_123 |
^/reports/2023.*\.pdf$ | Hide PDFs in /reports starting with 2023 | /reports/2023-01.pdf | /reports/2022-01.pdf, /reports/2023-01.txt |
^/secret/.*\.(jpg|png)$ | Hide images anywhere under /secret | /secret/foo.jpg, /secret/bar/abc.png | /secret/foo.png.txt, /foo/secret/abc.png |
You can hide some files and folders by setting the environment variable IGNORE to a pattern. By default everything is shown.
Legacy (v1.2 - v3.2) ignore pattern matching
Patterns are matched against the file name and every parent folder name individually not as a path.
For example if you have a file foo/bar/secret.txt. This path will be split into an array ['foo', 'bar', 'secret.txt'] and each part will be matched against the pattern. If at any point the pattern matches the name, it will be hidden.
Use case: Hide everything starting with a dot . using a .* pattern globally at any nesting level. This will hide /foo/bar/.foobar, /.baz, /foo/.secret/bar etc.
It uses fnmatch to match the pattern.
| Pattern | Description |
|---|---|
* | Matches everything (including nothing) |
? | Matches any single character |
[seq] | Matches any character in seq |
[!seq] | Matches any character not in seq |
- pattern
foowill hide the filefoo/bar/secret.txtbecausefoomatches the first array elementfoo. - pattern
*bar*will hide the filefoo/bar/secret.txtbecause*bar*matches the second array elementbar. - pattern
*.txtwill hide the filefoo/bar/secret.txtbecause*.txtmatches the third array elementsecret.txt.
Examples
-
*[ab].txthides all files or folder ending with eithera.txtorb.txt. -
.*hides all files or folder starting with a dot . -
[a-zA-Z0-9]*hides all files or folder starting with a letter or number. -
[!a-zA-Z0-9]*hides all files or folder not starting with a letter or number. -
report-???.pdfhidesreport-001.pdf,report-123.pdfbut notreport-1.pdf.
Multiple patterns
You can specify multiple patterns and separate them using ;. If any pattern matches, the file or folder will be hidden.
⚙️ Configuration
| Variable | Default | Values | Details |
|---|---|---|---|
| IGNORE | <empty> | <patterns> | changed to regex instead of fnmatch in v3.3added in v1.2 |
How to set configuration options
Use
docker run...- ...with
-e IGNORE=<empty> - ...with
--env-file .envand placeIGNORE=<empty>in the file