linux批量修改空格文件名,如何在包含空格的Linux中批量重命名文件?

本问题已经有最佳答案,请猛点这里访问。

我想通过用下划线替换所有包含空格的pdf文件。

所以我调用命令:

ls *.pdf | sed -e 'p; s/""/_/' | xargs -n2 mv

我在终端上遇到错误:

mv: cannot stat ‘Beginning’: No such file or directory

mv: cannot stat ‘Linux’: No such file or directory

mv: cannot stat ‘Line.pdf’: No such file or directory

mv: cannot stat ‘The’: No such file or directory

mv: cannot stat ‘Command’: No such file or directory

mv: cannot stat ‘Head’: No such file or directory

mv: cannot stat ‘C.pdf’: No such file or directory

mv: cannot stat ‘First’: No such file or directory

mv: cannot stat ‘Head’: No such file or directory

mv: cannot stat ‘PHP’: No such file or directory

mv: cannot stat ‘MySQL.pdf’: No such file or directory

mv: cannot stat ‘First’: No such file or directory

mv: cannot stat ‘and’: No such file or directo

你可能感兴趣的:(linux批量修改空格文件名)