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 an ignore pattern using regular expressions.
It uses preg_match to match the file path. Pattern matching is case insensitive.
If a match is found the file/folder will be hidden.
The path always starts with a /
, which is the mounted folder.
Examples
Pattern | Description | Hidden | Not Hidden |
---|---|---|---|
/\..* | Hide everything starting with a dot . like .env , .git ... | /foo/.bar , /.foo/bar | /foo/bar |
^/foo/.*\.txt$ | Hide everything in the folder /foo ending with .txt | /foo/abc.txt | /foo/abc.md , /bar/foo/abc.txt |
^/node_modules/ | Hide the folder /node_modules and its content | /node_modules | /foo/node_modules |
/node_modules/ | Hide the folder node_modules and its content at any level | /node_modules , /foo/node_modules | /node_modules_123 |
^/reports/2023.*\.pdf | Hide all pdf files in the folder /reports starting with 2023 | /reports/2023-01.pdf , /reports/2023-02.pdf | /reports/2022-01.pdf , /reports/2023-01.txt |
^/secret/.*\.(jpg|png)$ | Hide all images deep inside the folder /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.
Usecase: 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
foo
will hide the filefoo/bar/secret.txt
becausefoo
matches the first array elementfoo
. - pattern
*bar*
will hide the filefoo/bar/secret.txt
because*bar*
matches the second array elementbar
. - pattern
*.txt
will hide the filefoo/bar/secret.txt
because*.txt
matches the third array elementsecret.txt
.
Examples
-
*[ab].txt
hides all files or folder ending with eithera.txt
orb.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-???.pdf
hidesreport-001.pdf
,report-123.pdf
but notreport-1.pdf
.
Multiple patterns
You can specify multiple patterns and seperate them using a ;
. If any of the patterns 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 .env
and placeIGNORE=<empty>
in the file