小编Ris*_*huu的帖子

如何重命名带有“|”的文件 在他们之中?

我正在使用 Fedora 24。

我尝试了很多不同的方法来做到这一点。我已经在 Windows VM 下尝试过,将有问题的文件夹作为共享文件夹。

我试过使用“重命名”命令。

我试过使用“mv”命令。

我试过在“文件”中重命名它们。

我尝试将文件名设置为带有 inode 的变量,然后重命名。(失去了来源)

26477098 'File | With Pipe.png'
xyz=`ls -i|grep 26477098|sed 's/26477098 //'`
mv "$xyz" File\ --\ With\ Pipe.png
mv: cannot stat 'File | With Pipe.png': No such file or directory
Run Code Online (Sandbox Code Playgroud)

无论我尝试以何种方式执行此操作,我都不断收到“没有这样的文件或目录”错误。

我也尝试过使用它们的 inode 号重命名它们(“mv”文件的 inode 号名称为乱码?

26477098 'File | With Pipe.png'
[user@computer Pictures]$ find . -inum 26477098 -exec mv {} File\ --\ With\ Pipe.png \;
mv: cannot move './File | With Pipe.png' to 'File -- With Pipe.png': …
Run Code Online (Sandbox Code Playgroud)

shell quoting files

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

标签 统计

files ×1

quoting ×1

shell ×1