小编new*_*e17的帖子

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

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

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

linux shell move find

2
推荐指数
1
解决办法
1673
查看次数

标签 统计

find ×1

linux ×1

move ×1

shell ×1