Home > Back-end >  How to find possible unquoted pattern after predicate `-exec'?
How to find possible unquoted pattern after predicate `-exec'?

Time:03-29

I have 5 files that I want to unrar(and I have done it many times):

find . -name "*.rar"
./Udemy_Kubernetes_Mastery_Hands-On_Lessons_From_A_Docker_Captain_2020-4.part5_Downloadly.ir.rar
./Udemy_Kubernetes_Mastery_Hands-On_Lessons_From_A_Docker_Captain_2020-4.part2_Downloadly.ir.rar
./Udemy_Kubernetes_Mastery_Hands-On_Lessons_From_A_Docker_Captain_2020-4.part4_Downloadly.ir.rar
./Udemy_Kubernetes_Mastery_Hands-On_Lessons_From_A_Docker_Captain_2020-4.part1_Downloadly.ir.rar
./Udemy_Kubernetes_Mastery_Hands-On_Lessons_From_A_Docker_Captain_2020-4.part3_Downloadly.ir.rar

My command

find . -name "*.rar" -exec unrar x -o  \; Udemy_Kubernetes_Mastery_Hands-On_Lessons_From_A_Docker_Captain_2020-4.part1_Downloadly.ir.rar 

I got error

find: paths must precede expression: `Udemy_Kubernetes_Mastery_Hands-On_Lessons_From_A_Docker_Captain_2020-4.part1_Downloadly.ir.rar'
find: possible unquoted pattern after predicate `-exec'?

Why?

CodePudding user response:

Change your command into:

find . -name "*.rar" -exec unrar x -o  {} \;

Where {} represents the file found by the find command.

  • Related