Jump to content

Find files recently changed (similar to Trickster functionality)


Recommended Posts

I often need to do something with my last saved or changed files, like a screenshot or a file I just downloaded with CyberDuck or saved from inside an application.

 

Normally I use "Trickster" for that task. It which gives me access to files like recently downloaded, saved or edited files in a quick way but I thought it would be cool to have this in Alfred!

 

After a brief check of existing workflows I could not find any which does the same simple task: List files in the current users home which are modified or created in the last 48 hours. The list is sorted descending by modification time. I also made the result list searchable.

 

Simply type "last" and it will list the last modified files, you can press space and some letters to filter the results.

 

You also can press Return to open the file or CMD+Return to Browse to the file with Alfred (and then use File Actions on it).

 

https://github.com/oderwat/alfredworkflows/blob/master/Last%20changed%20files.alfredworkflow

 

This workflow uses "workflow class" by David Ferguson (@jdfwarrior) to build the resulting xml data. Besides that it uses a "mdfind" shell command which can be enhanced if you want to change where it searches and what it filters from the results (I filter some filetypes which are unlikely to be interesting for me).

 

I am supporting Updates by the "Alleyoop" Workflow now (Install that workflow from here: http://www.alfredforum.com/topic/1582-alleyoop-update-alfred-workflows/)
 
Feel free to comment!
 
Last Changed: 2013-04-19 19:06
 
V1.12: With the new Alfred 2 Update it is finally possible to fix the result order in a supported way (I modified workflow.php to support that).
V1.11: Yet another method to fix the result order! Added 'Docoments/My Games' to blacklist.
V1.10: Added iTunes to Blacklist (and a rather special personal Blacklist)!
V1.9: Fixed problem with missing files when they have the same timestamp.
V1.8: Updated to the new way Alleyoop works.
V1.7: Changed how files are choosen to include files recently created even if they have an old timestamp. Added Microsoft Office Support files to the blacklist. Added Parallels VM Files to the Blacklist.
V1.6: Made the found files in the result list draggable!
V1.5: Added Alleyoop Support and fixed another bug with listing order (hopefully the last time now).
V1.4: Fixed that the "oldest" entry was always displayed on the top (while the others where in descending order)
V1.1: I updated the script to exclude some more files (mysql data, files in ~/Library, Safari Bookmarks)
Edited by oderwat
Link to comment

I added Alleyoop Support (for semi auto-updates) and fixed another problem with listing order. In addition I filter ".opt" files (mysql creates them) too now.

 

For Alleyoop Support install this extension: http://www.alfredforum.com/topic/1582-alleyoop-update-alfred-workflows/ ... and ask other developers to include this update system into their workflows. I think it is pretty easy to do and worth the effort!

Link to comment

I added the attribute type="file" to <item> in the xml result for the filter.

 

Actually I am using here the workflow class by David Ferguson and there it comes after the last parameter he has documented (which is autocompletion text).

Awesome, good to know. Thanks.

Link to comment

This sounds great. Thanks for doing it. But I'm sorry to say that it's not working for me. It tells me that it's scanning (so I think I have it installed correctly), but it always tells me "No Docs." I've tried saving files of various sorts (.txt, .pages, .js, .doc) in a variety of directories (~home/Sites/folder, ~home/Dropbox/folder, ~/home/Documents/folder) but they don't show up on the list.

 

I'm 100% confident that it's something I've done wrong. Still, I thought I'd let you know. And make a sad face :(

 

- David

Link to comment

This sounds great. Thanks for doing it. But I'm sorry to say that it's not working for me. It tells me that it's scanning (so I think I have it installed correctly), but it always tells me "No Docs." I've tried saving files of various sorts (.txt, .pages, .js, .doc) in a variety of directories (~home/Sites/folder, ~home/Dropbox/folder, ~/home/Documents/folder) but they don't show up on the list.

 

I'm 100% confident that it's something I've done wrong. Still, I thought I'd let you know. And make a sad face :(

 

- David

 

It relies on Spotlight working and indexing your data and only scans in your home folder. Can you find those files by using normal Spotlight search?

Link to comment

Nice workflow.  

I've have MS Office installed, and when I run your workflow it shows a lot of files from /Users/.*/Documents/Microsoft User Data/*.   How do I skip those so they don't show up?

 

Thanks

 

James

 

I just uploaded a new version which changes how it scans and also excludes files form the directory you mention!

Link to comment

I just changed the way it scans to include files changed or "added" from the last 48 hours. This means it will also find a file which for example was extracted from a zip archive while maintaining it's original date!

Link to comment

Would it be possible to skip cache files?

In my case it shows a lot of sass cache files.

 

Yeah I am still optimizing. I try to not make a "white list" of folders but a black-list. So my extra folders in home are all caught.

 

Can you tell me the path of the files and probably also make a "mdls <filename>" in the terminal with some of them?

 

I guess you have multiple paths with such files (inside the .sass-cache folders I suspect)?

 

As I can not filter in spotlight for a file path I may need to exclude them from the results but would like to see if there is a better way to filter them out.

Edited by oderwat
Link to comment

Yep, that is the case.

 

Well I need to know their filenames & mdls attributes. I do not have any files like that for testing. I wonder why the actually are listet cause I do not get any files include in spotlight searches which are in folders starting with a dot character.

Link to comment

So there's something screwy with Mac #1.

 

Can you run a quick test and enter the following in a terminal window to see it it gives a result?

 

 

mdfind -onlyin ~/ 'kMDItemDateAdded >= $time.now(-7200)' 

 

This should list all files below your user home added in the last 2 hours.

 

 

And please try:

 

 

php -v 

 

and give me the result please!

 

May be hard to find that problem this way... probably something easily overseen :(

Link to comment

The mdfind line brings no results. Total blankness.

The reported php version is 5.3.15 (cli) (built: Jul 31 2012 18:42:11)

Just for fun, I tried mdfind on the Mac on which your workflow works, and got a long list of files in return.

I'm going to nuke my Spotlight index and rebuild it.

I appreciate your spending time on what is undoubtedly a problem with my environment. I'll let you know how it goes after I rebuild the index. Thanks!

LATER THAT DAY: I rebuilt the Spotlight index but still no results from the mdfind command line...

Edited by davidjoho
Link to comment

I added the iTunes Folder to the Blacklist and made a personal Blacklist which just triggers on my system (dependent on the user name of the login user). Maybe I create a way to store personal data for the blacklist in the future.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...