Add excluded_directories as config option

(migrated from github issue #26651)

Is your feature request related to a problem? Please describe.
An Owncloud instance I administrate has lots of directories with tons of irrelevant files (eg temporary files or symlinks) on local and external storages. For now, we can use the excluded_directories option to tell OC to completely ignore the directories matching some patterns and to not include them in DB.

We would love to migrate our users to Nextcloud, but we can’t find such option available. Nothing in the doc, and #6888 mention the app files_excludedirs which doesn’t seem to live anymore. I believe there is a few more people hoping for this feature as well.

Describe the solution you’d like
Would be great if this option was also available on NC, either natively or through a custom app.

Describe alternatives you’ve considered
Haven’t found any alternative.

Additional context
If someone has enough time to develop this feature, a bonus would be to accept wildcards in patterns.

Thank you

1 Like

Well, you could revive that files_excludedirs plugin. There is a PR in there to make it compatible with NC15, which is a start in the right direction.

Or, why don’t you clean out the irrelevant files from the tree? If you need those files to be available for another purpose, you should be able to use unionfs to merge two trees together.

I just tested the version from GitHub - apippin/files_excludedirs: Nextcloud app to exclude directories (which is the PR in the nextcloud-repo), but it does not seem to work, even after “faking” compatibility in the appinfo/info.xml as suggested in issue #5. I can install and activate the plugin, set the filter-values as well, but they just dont seem to get respected in occ files:scan… At least not on locally-mounted external storage.

maybe using rclone useful as webdav

Please give this unsigned release a spin; should work on 23x.:

As it turns out – as I just answered on How does this work? · Issue #3 · nextcloud/files_excludedirs · GitHub – it only appears to affect new files, but it doesn’t remove matching files from the file cache (it will block access to them, though). If you have existing files that the plugin matches that should not appear in search results, you will need to remove them from the NC database manually.

I’ve provided updated docs in my fork of the Readme (specifically, how it works with existing vs. newly-added files):

Feedback is welcome here:

I’ll have to look into publishing an official, signed package because I wasn’t the original author of this one – I just updated the work of others.

How do you define the exclusions? I’m using this and it’s not working

$ occ config:app:set files_excludedirs exclude --value ‘[“CACHE”]’
$ php occ config:app:get files_excludedirs exclude

After a scan is started, manually or by cron, files start showing up again

mysql -e “select * from nc_db_a.oc_filecache WHERE path LIKE ‘%CACHE%’ limit 1”
| fileid | storage | path | path_hash | parent | name | mimetype | mimepart | size | mtime | storage_mtime | encrypted | unencrypted_size | etag | permissions | checksum |
| 736044 | 3 | files/Shared/CACHE | f2bb41c5e1bd131ed25c5776886a2868 | 3003 | CACHE | 2 | 1 | -1 | 1662942483 | 1662942483 | 0 | 0 | 632ac2592357f | 31 | |
…and the rest

An easier way to do this could be to enable the support for .nomedia file like android does?