简体   繁体   English

查找具有特定名称的所有子文件夹,以便超级文件夹具有特定模式

[英]finding all subfolder with certain name such that superfolder has certain pattern

hi all I have a folder that has folders with lots of different names. 大家好我有一个文件夹,其中包含许多不同名称的文件夹。 However I want to find all the folder that start with RUN and have a subfolder of complete . 但是我想找到所有以RUN开头并且子文件夹complete的文件夹。 How can I do such a thing in terminal? 我怎么能在终端做这样的事情?

As Mac OS X is UNIX based you can use many terminal programs found on Linux etc. too. 由于Mac OS X是基于UNIX的,因此您也可以使用Linux等上的许多终端程序。 Therefore this question is not necessarily OS X related. 因此,这个问题不一定与OS X有关。

Using find you can get all your RUN folders with a complete folder in it: 使用find您可以获得包含complete文件夹的所有RUN文件夹:

find path_to_your_folder/Run*/complete -maxdepth 0

This gives you a list like 这给你一个像这样的列表

path_to_your_folder/Run3221/complete
path_to_your_folder/Run3289/complete

With ´sed´ you can extract from this the individual folder names: 使用'had',您可以从中提取单个文件夹名称:

find test/Run*/complete -maxdepth 0 | sed 's/.*\(Run[0-9]*\).*/\1/'

which gives you a list like you're looking for: 它给你一个像你正在寻找的列表:

Run3221
Run3289

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 Unix 中查找具有特定扩展名的所有文件? - Finding all files with certain extension in Unix? 递归查找与特定模式匹配的所有文件 - Recursively find all files that match a certain pattern 在Mac Terminal中以特定名称查找所有文件中的字符串 - Find a String in all Files with a certain name in Mac Terminal 查看NSBezierPath是否做出某种形状或图案 - See if NSBezierPath(s) make a certain shape or pattern 检查用户在可可应用中是否具有某些服务 - check if user has certain service in cocoa app 如何在Mac上列出文件夹中具有特定字符串的所有文件? - How to list all the files in a folder that have a certain string in their file name on Mac? 宏循环遍历工作簿中的所有工作表,测试单元格是否具有特定值。 如果是,复制工作表并退出循环 - Macro to loop through all sheets in the workbook, test if a cell has a certain value. If yes, copy the sheet and exit the loop awk:根据图案变换某些线条,按原样打印其余线条 - awk: transform certain lines based on pattern, print the rest as-is 尝试使用某种模式将结果grep到文件中,发生奇怪的行为 - Trying to grep results to a file using a certain pattern, weird behavior occurring iTunes AppleScript:查询包含特定曲目的所有播放列表 - iTunes AppleScript: query all playlists that contain a certain track
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM