![Forrest logo](/images/logo.png)
mdfind:tldr:52a0d
The command mdfind -onlyin ${directory} "${query}"
is used to search for files or documents that match a specific search query within the specified directory. Here is a breakdown of the command: - mdfind
: This is a command-line utility on macOS that allows you to find files based on different attributes such as file name, content, or metadata. - -onlyin ${directory}
: This option specifies the directory in which the search should be performed. You need to replace ${directory}
with the actual path of the directory you want to search in. - "${query}"
: This is the search query that specifies the criteria for finding files. The query can be a simple string or a more complex query using boolean operators, metadata attributes, and keywords. The query should be enclosed in double quotes. For example, if you want to search for all text files within the "Documents" folder that contain the word "apple," you would use the following command: ```
mdfind -onlyin ~/Documents "apple"