Skip to content
Advertisement

Copy several files to current directory using find on busybox

I have the following snippet that works well non normal terminals (for example, on cygwin):

find . -name '*.aab' -or -name '*.apk' -exec cp '{}' ./ ;

What it should do is find all the files that match the provided patterns and copy them to the current directory. However, when I run this terminal on Github Workflows it only copies the .apk files, like if it were ignoring the first item on the or. I know there are aab files because using another tool on the next step (upload artifacts) I’m able to target those files using the same glob. The problem of using upload artifacts directly with the glob is that the resulting zip will preserve the long and weird directory structure, and I want a flat zip file.

I think GithubAcitons uses busybox so, how can I accomplish that using busybox?

Thanks and regards.

Advertisement

Answer

This example using precedence ( ) works with Linux find and busybox find; note POSIX compliance with -o vs. -or

find . ( -name '*.aab' -o -name '*.apk' ) -exec stat '{}' +
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement