【问题标题】:How to extract the file with same name from different directories in linux? [closed]如何从linux中的不同目录中提取同名文件? [关闭]
【发布时间】:2020-12-24 10:02:17
【问题描述】:

我有很多具有相同文件名的文件夹,例如:

   fd1/01.wh.txt  
   ff2/01.wh.txt  
   fk2/01.wh.txt 
   fd3/01.wh.txt 

我想从这些不同的目录中提取01.wh.txt,并得到一个包含所有01.wh.txt和特定父代码的新文件夹:

new_folder/   
   fd1.01.wh.txt 
   ff2.01.wh.txt  
   fk2.01.wh.txt  
   fd3.01.wh.txt

如何在Linux系统中执行代码?

【问题讨论】:

  • 使用查找命令
  • 感谢您的回复!我输入了代码find -name '01.wh.txt' -type f > temrcp temr testresult/,但是我只是在testresult中得到了temr文件。

标签: linux file extract


【解决方案1】:

试试这个..

对于我在find . -name "*.txt";回声 $i; fname=echo $i|sed 's/\//-/g';回声 $fname; cp $i ./newdir/$fname;完成

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-08
    • 2020-02-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-15
    相关资源
    最近更新 更多