I would like to move files I have from one directory to another using an array of keywords to find and categorize the files. I have some syntax issue with my find command and I'm not sure how to solve it. The error is:
./Process.sh: line 7: \*building\*: syntax error:
operand expected (error token is "\*building\*")
Here is the script:
#!/bin/bash
declare -a keyword=("*building*")
declare -a directory=("Building")
for i in "${keyword[@]}"
do
echo find /run/media/_Incoming/ -type f -name "${keyword[$i]}" \
-exec echo mv -t /run/media/"${directory[$i]}"/ {} +
done