gpt4 book ai didi

unix - 根据文件名中的特定模式移动文件

转载 作者:行者123 更新时间:2023-12-04 04:41:37 24 4
gpt4 key购买 nike

我必须将名称中具有以下模式的文件列表:“_my_file”从子文件夹复制到一个主文件夹中。文件名显示如下:

A_my_file.txt
B_my_file.txt
C_my_file.txt

我使用了以下字符串,但它不起作用:

find . -name "*_my_file*" -exec mv "{}"./dest_fld \;   

最佳答案

"{}" 之间添加空格和 ./dest_fld :

find . -name "*_my_file*" -exec mv "{}" ./dest_fld \;   
# ^

会更好 dest_fld位于当前目录之外。除非, dest_fld也会被扫描。

关于unix - 根据文件名中的特定模式移动文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18788570/

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