尝试使用脚本将目录中的文件夹从内部硬盘移动到外部硬盘....
#!/bin/bash
for i in *; do
if [[ $i == [* ]]; then
mv $i /entertainment/movies/;
fi
done
我收到以下错误:
mv: cannot stat 'DVDRip': No such file or directory
mv: cannot stat '-': No such file or directory
mv: cannot stat 'x264': No such file or directory
mv: cannot stat '-': No such file or directory
mv: cannot stat 'DD5.1': No such file or directory
mv: cannot stat '-': No such file or directory
mv: cannot stat '1GB': No such file or directory
mv: cannot stat '-': No such file or directory
mv: cannot stat 'ESub': No such file or directory
答案 0 :(得分:0)
使用双引号进行环绕变量扩展,以确保正确处理空格。
mv "$i" /entertainment/movies/
如果只循环您感兴趣的文件,则可省略if
测试。
for i in [*; do
mv $i /entertainment/movies/
done
然后你甚至可以放弃循环。
mv [* /entertainment/movies/