How to Implement Multi-File Actions in Alfred 1.3

I wanted to write up a quick post on how I implement multi-file actions in Alfred 1.3 so you can get a better idea on how to use the new feature and hopefully use this to start making your own multi-file extensions.

My language of choice, as usual, is bash; however the concept is the same in any language. Alfred provides your extension with a tab delimited string of files that you parse and perform actions on.


The code above is a basic implementation in bash that parses the input by tabs and puts each file in to an array. Then iterates through the array and does something with each file. The only line worth specifically noting is the line:


Even though tabs are already apart of the default IFS (input field separators) along with spaces and newlines – I have overwritten the IFS to consist of only tabs so that filenames with spaces don’t break up in to multiple items in the array.

Here is a full blown example implementation in an Alfred shell script extension that is designed to accept multiple files and batch rename the files based on a prefix supplied by the user. A download link for the extension is provided at the end of the post. [1]

*Note: In order for this extension to accept multiple files, it is required to check the new option in the extension’s settings: “Accept multiple files as argument”

To wrap this up, here is a video of the extension in action:

  1. Alfred Extension Download Link: Rename Multiple Files