gpt4 book ai didi

linux - 如何在 Linux shell 中复制带空格的多个目录

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:27:34 25 4
gpt4 key购买 nike

我有一个电影目录(它们在自己的文件夹中),我只想传输其中的一些。

为什么这行不通?

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*}(带有文件名末尾的 })。

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

关于linux - 如何在 Linux shell 中复制带空格的多个目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34532368/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com