Glob support in ipfs add command

I have a question about the ipfs add command: is it possible to add only a subset of the files of a directory tree?

I have a sort of “glob” that selects files inside a tree (technically it is a sort of “subset” of the tree), and I’d like to be able to add that subset (and have its hash) without creating it explicitly in the file system.

Is there a command or an API entry that does this?

If you have a command that selects the files you want and returns them to stdout, you should be able to pipe that into ‘ipfs add’. That will get all of your files into ipfs but I’m not sure if you’ll be able to make it build directory objects to tie everything together. The ‘-w’ argument might work.