Search entire file tree Terminal
我不完全确定该如何回答这个问题,但我想在终端中传递一个文件参数,这个参数将搜索一个目录以及每个可能的子目录,并通过整个文件树来工作。目前,我通过了
如果要运行此:
1 | java -jar ~/Downloads/simian-2.3.35/bin/simian-2.3.35.jar files ~/Classes/**/* |
您可以这样做:
1 | java -jar ~/Downloads/simian-2.3.35/bin/simian-2.3.35.jar files $(find ....) |
原始答案
基本上使用
1 2 3 4 5 6 7 8 9 | find ~/Classes -type f # find, starting in your"Classes" directory, all files find ~ -type f # find, starting in your HOME directory, all files find ~ -type d # find, starting in your HOME directory, all directories find ~ -name"*fred*" -type f # find all files whose name contains"fred" anywhere in them find ~ -iname"*FRED*" -type f # find all files whose name contains"fred" or"FRED" or"Fred" anywhere in them |
使用
1 | find ~Classes -type d |
如果
1 | find ~/Classes -type d |
如果使用bash,则需要启用
1 2 3 | shopt -s globstar printf '%s ' ~/Classes/**/*/ |