2015-09-17 84 views
0

我需要在当前文件夹(非递归)和其他一些文件夹(递归)中查找文件。例如我有一个树结构,如:Linux仅为当前文件夹和指定文件夹找到'''

  • 的folder1/
  • 文件夹2/
    • folder2-1/
      • file2-1.php
  • folder3/
    • file3-1.php
  • file1.php
  • file2.php

我想找到的文件file1.phpfile2.phpfile2-1.php只。所以,在根目录+ folder2 /中递归搜索。

所有我能找到的资源描述要么

find . -maxdepth 1 -iname "*.php" // gives `file1.php` and `file2.php` 

find folder2 -iname "*.php" // gives me `file2-1.php` 

所以:

问:如何结合这些命令?

P.S.我应该能够在命令行中进一步发送找到的文件的列表(例如xgettext)。

回答

1

是否这样?

(find . -maxdepth 1 -iname "*.php"; find folder2 -iname "*.php") | xgettext 
+0

工作就像一个魅力,@tink!谢谢。 – spliter

相关问题