I'm trying to use a shell script to:
- return all .mov files in a given directory
- without path, file names only
- filtering out dot-underscore files from results
- separate each result by \n but haven't even gotten to that part
I don't know why there are dot underscore files, but it's a shared server so I didn't want to delete them just in case. There are also spaces in the Path, so separating results by spaces gives interesting results.
So far I've figured out how to do these things but not in tandem. This command will return all results, no dot underscore files, but it returns only the full path, can't get it to return basename:
results="$(find /Path/ -iname "*.mov" -type f | grep -vF '/._')"
And then this command will return only basenames, but includes dot-underscore files
results="$(find /Path/ -iname "*.mov" -execdir echo {} ';' | grep -vF '/._')"
As you can see in the second attempt I tried to link the two together... but somehow -execdir is making the command ignore the grep command at the end. I'm sure I'm just piping something wrong, but please let me know.
result
afterwards, why do you need newlines in there?