The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

File::Spotlight - List files from Smart Folder by reading .savedSearch files

SYNOPSIS

  use File::Spotlight;

  my $search = "$ENV{HOME}/Library/Saved Searches/New Smart Folder.savedSearch";

  my $spotlight = File::Spotlight->new;
  my @found     = $spotlight->list($search);

DESCRIPTION

File::Spotlight is a simple module to parse .savedSearch Smart Folder definition and get the result by executing the Spotlight query by mdfind command.

This is a low-level module to open and execute the saved search plist files. In your application you might better wrap or integrate this module with higher-level file system abstraction like IO::Dir, Path::Class::Dir or Filesys::Virtual.

METHODS

new

Creates a new File::Spotlight object.

list
  @files = $spotlight->list($saved_search);

Given the file path to .savedSearch (usually in ~/Library/Saved Searches/ folder), executes the query and returns the list of files found in the smart folder.

AUTHOR

Tatsuhiko Miyagawa <miyagawa@bulknews.net>

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

http://www.macosxhints.com/dlfiles/spotlightls.txt