the command find not working with -name option in sh file
4
votes
1
answer
452
views
I am using the following command to retrieve the number of files which names contains
sv
or json
in a given directory in a remote server:
nbs_files=ssh -q -i ${sshkey} ${user}@${server} "find ${path}/ -maxdepth 1 -mindepth 1 -type f -name '*sv*' -o -name '*.json' -exec basename {} \; | wc -l"
This command returns only the number of .json
files, whereas files with sv
in their names exist in the ${path}
.
When I remove the -o -name '*.json'
part, the command works well, and returns the number of files containing the 'sv' in their names.
Does anyone know how can I modify the command in order to retrieve the files containing sv
in their names and the files with the extension .json
as well?
Asked by rainman
(149 rep)
Jul 5, 2020, 03:13 AM
Last activity: Jul 6, 2020, 10:20 AM
Last activity: Jul 6, 2020, 10:20 AM