| File::Spotlight - List files from Smart Folder by reading .savedSearch files |
File::Spotlight - List files from Smart Folder by reading .savedSearch files
use File::Spotlight;
my $path = "$ENV{HOME}/Library/Saved Searches/New Smart Folder.savedSearch";
my $folder = File::Spotlight->new($path); my @found = $folder->list();
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 the IO::Dir manpage, the Path::Class::Dir manpage or the Filesys::Virtual manpage.
$folder = File::Spotlight->new("/path/to/foo.savedSearch");
Creates a new File::Spotlight object with the .savedSearch file
path usually in ~/Library/Saved Searches folder.
@files = $folder->list;
Executes the saved Spotlight query and returns the list of files found in the smart folder.
Tatsuhiko Miyagawa <miyagawa@bulknews.net>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
http://www.macosxhints.com/dlfiles/spotlightls.txt
| File::Spotlight - List files from Smart Folder by reading .savedSearch files |