gpt4 book ai didi

linux - Linux下如何批量复制不同文件夹下的文件?

转载 作者:太空宇宙 更新时间:2023-11-04 04:26:32 24 4
gpt4 key购买 nike

假设我们有文件

   a/xxx-data.html
b/c/xxx-data.html
d/xxx-data.html

我们想要在同一文件夹下复制每个文件,但使用不同的名称模式,如下所示

   a/yyy-data.html
b/c/yyy-data.html
d/yyy-data.html

我只是好奇,我们可以通过组合“find”、“xargs”和“awk”来做到这一点吗?

最佳答案

不需要任何这些程序。只是

for file in **/xxx*.html; cp $file ${file/xxx/yyy}

在 zsh 中就足够了。 bash 的命令应该非常相似。

克里斯·HTH

关于linux - Linux下如何批量复制不同文件夹下的文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8405283/

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