Skip to content

Instantly share code, notes, and snippets.

@smw
Created May 15, 2014 10:06
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smw/a21a9f675ed3358830da to your computer and use it in GitHub Desktop.
Save smw/a21a9f675ed3358830da to your computer and use it in GitHub Desktop.
Pop this somewhere in your path. Finds files/directories/links, with globbing.
#!/usr/bin/perl -w
if (@ARGV < 1) {
print "Usage: mdf <file glob to search for>\n";
exit(1);
}
my $nameGlob = shift @ARGV;
exec ('mdfind', qq(kMDItemFSName=='${nameGlob}'c), @ARGV) or
print $STDERR "Couldn't find mdfind: $!";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment