I’ve thought often of how much it could be useful to be able to do a Spotlight search on your Mac at home when you are away.
Just for when You need something you forgot to bring with you.
Now I think I’ve found a practical solution.
You need the following things to accomplish the task:
- a Mac from which you want to fetch content (your Mac at home, always on and connected)
- a Dropbox account configured on it
The process is as follows
- on your Mac at home you install the files that are in this zip file. Uncompress it in your Dropbox folder
- download and install this Folder Action workflow (unzip and double click on it)
Now your Mac is ready to receive commands.
All you have to do is to write a file in the spotlightremote/commands folder named as you wish.
Try writing the string “find .doc” without the quotes in a file named find.txt in your ~/Dropbox/spotlightremote/commands folder
After a few seconds you should have a new file created in ~/Dropbox/spotlightremote/output folder, named results.html
It’s an HTML file with the results of the search.
The interesting part is that having the watched folder in your Dropbox You can execute commands from any pc or Mac with Dropbox client on it and also through the Dropbox web interface.
I’ve implemented for now only three commands:
- find: find files by name (I’ll try to implement more search types in the future) in your home folder (ex: find .avi)
- preview: create a preview of a single file using the QuickLook engine (qlmanage shell command) and put it in the output folder; need absolute path as a parameter, you can copy it from the result.html file you got from a find command clicking on the corresponding link.
- copy: it copies the file you pass as a parameter to the output folder (also need full path of the file as a parameter)
The last thing, to speed things up a little, is an Alfred extension you can use on your other Mac (your laptop or your Mac at work).
Just download and install.
You can invoke it Just like this:
slr find .doc
It will save the command in the right place to trigger the folder action.
Important: the folder action acts only on new files created. You have to first delete your command file and save a new one. Speed of execution may vary.
Note: it’s an experiment and may not work for you – Use at your own risk – at this time there are no checks on inputs so there are some security concerns to evaluate (if someone gain access to your Dropbox account may have access to all the files in your Mac at home). I’ll Try to improve it in the future. To remove the Folder Action go to ~/Library/WorkflowsApplications/Folder Actions/ and delete the Spotlight Remote.workflow.