簡體   English   中英

在Linux Shell中如何使用空格復制多個目錄

[英]How to copy multiple directories with spaces, in Linux shell

我有一個電影目錄(它們在各自的文件夾中),我只想傳輸其中的一些。

為什么不起作用?

movie*代表目錄

cp -r {movie*, otherMovie*} "/var/media/store n go"

"cp: can't stat '{movie*,': No such file or directory"
"cp: can't stat 'otherMovie*}': No such file or directory"

不要在逗號后放置空格,以免花括號被處理。 因此,它正在尋找與{movie*, (在文件名的開頭帶有文字{ )和其他othermovie*} (在文件名的末尾帶有}othermovie*}的文件。

cp -r {movie,otherMovie}* "/var/media/store n go"

這應該在源名稱中使用空格。

$ touch "Avengers Age of Ultron" "Die Hard A Good Day"
$ echo {"Avengers Age of"*,"Die Hard A Good"*}
Avengers Age of Ultron Die Hard A Good Day

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM