如何移动( mv )具有空格和特殊字符的文件 - linux 命令
file.txt 包含以下内容。
04 安全@test.pdf
05 安全@test.pdf
我的命令如下:
cat $DIR/file.txt | read line; do
mv $line ""$line{//[ ()@$]/_}" /$DIR/OUT done
非常感谢您的专业知识,
最佳答案
此命令从 file.txt
读取每一行,然后重命名文件,用 _
替换每个特殊字符。
$ while read line ; do mv "$DIR/$line" "$DIR/${line//[ ()@$]/_}" ; done < file.txt
关于linux - mv 来自文本板的包含空格和特殊字符的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50712183/