# mdfind

Published articles for mdfind.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## A Shorty But a Goody, Sorting mdfind Results by Date or Size

DevFeed: [A Shorty But a Goody, Sorting mdfind Results by Date or Size](<https://devfeed.tech/articles/a-shorty-but-a-goody-sorting-mdfind-results-by-date-or-size-28213.md>)

Original publisher: [Read original article](<http://fuzzyblog.io/blog/osx/2020/08/12/a-shorty-but-a-goody-sorting-mdfind-results-by-date.html>)

Author: Fuzzygroup

Published: 2020-08-12T05:48:00Z

Content type: tutorial

Language: en

Sources: [Scott Johnson](<https://devfeed.tech/sources/scott-johnson.md>)

Topics: [Command-line interface](<https://devfeed.tech/topics/cli.md>), [Unix](<https://devfeed.tech/topics/unix.md>), [ls](<https://devfeed.tech/topics/ls.md>), [Sorting](<https://devfeed.tech/topics/sorting.md>)

Tags: [apple](<https://devfeed.tech/tags/apple.md>), [command](<https://devfeed.tech/tags/command.md>), [command-line](<https://devfeed.tech/tags/command-line.md>), [files](<https://devfeed.tech/tags/files.md>), [hacks](<https://devfeed.tech/tags/hacks.md>), [ls](<https://devfeed.tech/tags/ls.md>), [mdfind](<https://devfeed.tech/tags/mdfind.md>), [osx](<https://devfeed.tech/tags/osx.md>), [sorting](<https://devfeed.tech/tags/sorting.md>), [unix](<https://devfeed.tech/tags/unix.md>)

### AI overview

A short tutorial showing how to pipe mdfind results through xargs to list files sorted by modification date or calculate and sort file sizes.

### Source excerpt

mdfind is an OSX executable which taps into the underlying spotlight index to find files quickly. However if you want to quickly sort results you need to pipe its output (the symbol i.e. shift key + forward slash) into another program. The program we are going to send its results to is xargs which then handles integrating the results from mdfind with another command and organizing the results. Note: I regard xargs as "Unix Dark Magic"; I've never fully understood it but it is one of those things that when I need a powerful command line incantation, I tend to think "Hm.... Needs Me Some xargs Here". Sorting by File Date To sort files by name, make a variant of this: mdfind -name url_common.rb -0 | xargs -0 ls -lt Sorting by File Size To sort files by file size, make a variant of this: mdfind -name url_common.rb -0 | xargs -0 du -hc | sort -g This one is interesting because it pipes from mdfind to xargs running du -hc and then to sort. See Also Apple.com Hacks for Macs

## How to Find the Latest Version of a File on OSX Using mdfind

DevFeed: [How to Find the Latest Version of a File on OSX Using mdfind](<https://devfeed.tech/articles/how-to-find-the-latest-version-of-a-file-on-osx-using-mdfind-28210.md>)

Original publisher: [Read original article](<http://fuzzyblog.io/blog/osx/2020/04/26/how-to-find-the-latest-version-of-a-file-on-osx-using-mdfind.html>)

Author: Fuzzygroup

Published: 2020-04-26T00:00:00Z

Content type: tutorial

Language: en

Sources: [Scott Johnson](<https://devfeed.tech/sources/scott-johnson.md>)

Topics: [osx](<https://devfeed.tech/topics/osx.md>), [ls](<https://devfeed.tech/topics/ls.md>), [Library](<https://devfeed.tech/topics/library.md>)

Tags: [article](<https://devfeed.tech/tags/article.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [library](<https://devfeed.tech/tags/library.md>), [ls](<https://devfeed.tech/tags/ls.md>), [mdfind](<https://devfeed.tech/tags/mdfind.md>), [osx](<https://devfeed.tech/tags/osx.md>)

### AI overview

A brief macOS how-to showing how to use mdfind, xargs, and ls -t to locate the latest version of a file, illustrated with a library file.

### Source excerpt

"""< HEAD ======= 4cbbc577cf49ce99e5aaf8b73f0396e50651d3a9 I recently wanted to find the latest version of a library I wrote and I started by using mdfind: mdfind -name select_page_parser.rb I then added xargs per this article: mdfind -name select_page_parser.rb -0 | xargs -0 ls -t