Clarification for "files" instead of deprecated "excludeFiles" needed (153.1)

Hi, It seems I’m not entirely getting the new files filter, maybe add some examples to the documentation?

For a long time I had to have this block in my config:

  [[module.mounts]]
    excludeFiles = '/**.DS_Store'
    source = 'assets'
    target = 'assets'

The reason was because one of my shortcodes gatheres images from assets (working on a mac, you inadvertently create these hidden files everywhere you go) and maybe the image process function was choking on them, I don’t know anymore exactly…

So, now I’m getting that deprecation info and want to clear that up. How would I go about converting this block to use files?
Maybe something like this:

  [[module.mounts]]
    files = [ '! *.DS_Store', '**' ]
    source = 'assets'
    target = 'assets'

You don’t need the “**”, but I guess it make it clearer/easier to understand.

But the ! *.DS_Store is probably not doing what you want. The * wildcard does not match /, so I suspect you’d be better off with ! **.DS_Store', see GitHub - gobwas/glob: Go glob (we use / as delimiter for most matching in Hugo).

1 Like

Thanks, it works now with files = [ '! **.DS_Store' ] (and also the slash was superfluous in my original config…)

1 Like

Your approach is correct, and adding examples to the documentation would help others understand the new files filter more easily. Replacing it with files = [‘!/*.DS_Store’, '’] should cover your use case.

Can you explain?