移动名称中有空格的多个文件 (Linux)

new*_*e17 2 linux shell move find

我有一个目录,其中包含多个名称中带有空格的文件。我想在名称中找到一个模式,这些文件将被移动到其他目录。现在的问题是,当在单个文件名中找到特定模式时,该文件正在移动到目标路径,但是当有多个文件时,此方法失败。下面是我正在使用的代码:

for file in `find . -maxdepth 1 -name "*$pattern*xlsx" -type f`
do
 mv "$file" $destination/
done
Run Code Online (Sandbox Code Playgroud)

jll*_*gre 6

无需使用循环:

find . -maxdepth 1 -name "*$pattern*xlsx" -type f -exec mv {} $destination +
Run Code Online (Sandbox Code Playgroud)