There are two typos in your command.
\{}
should be {}
The \␣
(backslash+space) should be \;
or ';'
.
The -exec
option/predicate of find
needs to know where the command that it executes ends. It is told this by the ;
at the end (which needs to be quoted to protect it from the shell).
You should not need to escape or quote {}
.
There might be some issues with precedence too. You basically say
condition OR condition AND run-this-command
which is ambiguous. It would be better to say
(condition OR condition) AND run-this-command
This does that:
find . -type f '(' -name '*.avi' -o -name '*.mkv' ')' \
-exec basename {} ';' > ~/Bash/test/rm/films.txt
I've also added -type f
so that only regular files are considered.
;
. Also it appears to work for me but I don't believe there is any reason to escape{}
– jesse_b Feb 26 '18 at 16:30