我已经下载了音频youtube-dl,然后我想改名MV:
mv "Powerwolf - Resurrection By Erection-Hiu1hPdJk-Y.mp3" "Powerwolf - Resurrection by Errection.mp3
>"
但是,当我想对重命名的文件执行某些操作时,bash 会打印:
root@bananapi:~/Music# mv "Powerwolf - Resurrection by Errection.mp3 " All
mv: cannot stat 'Powerwolf - Resurrection by Errection.mp3 ': No such file or directory
当我打字时ls-l,bash 打印:
root@bananapi:/home/music/Music# root@bananapi:/home/music/Music# ls -l
total 3860
drwxr-xr-x 2 music music 4096 Apr 19 11:49 All
-rw-r--r-- 1 music music 360 Apr 19 12:34 download.py
drwxr-xr-x 2 music music 4096 Apr 19 11:48 Eleven
drwxr-xr-x 2 music music 4096 Apr 18 20:49 KlemenSlakonja
drwxr-xr-x 2 music music 4096 Apr 19 11:49 LittleBig
drwxr-xr-x 2 music music 4096 Apr 18 20:28 Powerwolf
-rw-r--r-- 1 root root 3924591 Oct 24 15:03 Powerwolf - Resurrection by Errection.mp3 ?
现在,我想删除这个文件,但我不能。
答案1
您最初mv
将文件重命名为末尾包含换行符的名称。您忘记关闭新名称的引号字符串并按下Enter。按Enter(插入换行符)后 ,您关闭了双引号。这会在文件名中插入一个换行符。
要重命名该文件,请使用
mv $'Powerwolf - Resurrection by Errection.mp3 \n' 'Powerwolf - Resurrection by Errection.mp3'
注意 之前的空格\n
。根据输出看来应该有这个ls
。
您还可以使用 a*
将名称末尾与换行符匹配:
mv "Powerwolf - Resurrection by Errection.mp3"* "Powerwolf - Resurrection by Errection.mp3"
答案2
您的新文件名末尾似乎有一个换行符。看来您在输入命令末尾的Enter结束引号之前已经按下了。为了纠正这个问题,请输入"
mv
mv "Powerwolf - Resurrection by Errection.mp3 <--- Press Enter here
" "Powerwolf - Resurrection by Erection.mp3"