the linux command works well in the terminal, but not in the sequence of commands in several lines

0

a basic program to search for files by their extension and move them to a new location, for example:

search for files by extension "mkv" and move them to the folder / x

user@user$ find /home/example1 -type f -name '*.mkv' -exec [mv -f example/directory] \;

but when I insert more than one line into the same script, the system says that it does not understand the "-exec" function

find: missing argument to '-exec'

to run the script I used a

sh programa

script example in script:

find /carpeta1/carpeta -type f -name '*.mkv' -exec [mv -f /carpeta35] \; 
find /carpeta3/carpeta -type f -name '*.avi' -exec [mv -f /cartepa22] \;
    
asked by Alexneb Glaz 01.10.2018 в 23:44
source

1 answer

0

What you pass to exec is what is between {} and what is failing you to put it in a single line is that it takes a semicolon between the end of the first find and the beginning of the next.

 -exec loquesea {} \; ; find /carpeta3/carpeta 

find /carpeta1/carpeta -type f -name '*.mkv' -exec mv {} -f /carpeta35 \; ;    find /carpeta3/carpeta -type f -name '*.avi' -exec mv {} -f /cartepa22 \;
    
answered by 02.10.2018 в 12:51