Jump to content

Move selected files to folder w/ File Filter

Recommended Posts

Need some help figuring out a workflow I'm working on.
In Alfred 1, and now in Alfred 2, I've always had a series of workflows whereby pressing a hotkey or entering a keyword the currently selected file (in the finder) is moved to a predetermined location. I have always used Applescript for this, as it is the only language I'm familiar with (if it can even be said I'm familiar with it…). For example:
tell application "Finder"
        move selection to "insert folder here"
end tell
This is great for most cases, as I just need a quick way to move a file from one place to another (don't want to search through  filter to choose the folder)
However, there is a case where I want to choose the folder to move the item to from a list: I have a Folder in my NAS with many subfolders, and I want to be able to invoke a keyword in alfred, see the list of folders, and choose one.
Right now, I do this all inside applescript using a  (choose from list) dialog:


on alfred_script(q)
tell application "Finder"
    set destfolder to "examplefolder" as alias
    set thelist to name of every folder of destfolder
    set selectedseries to (choose from list thelist) as text
    move selection to "examplefolder:" & selectedseries as alias
end tell
end run


but it would obviously be much more elegant doing it through alfred.
I guess the best way is to use a script filter, but I have no idea how to write it.
I've been trying to get it done by using a File Filter, but I can't seem to get applescript to action on the output of this filter.
I fgured something like this would work:


on alfred_script(q)
set movefolder to q
tell application "Finder"
     move selection to movefolder as alias
end tell
end run
But no cigar. I don't know if maybe I should use something besides {q}, or what else is going on...
Any ideas?
Link to comment

If it's a preset list of folders that you would use, a modified version of something like my Faves workflow may work to accomplish this. You could use a hotkey to grab the selection and pass that to a script filter that would list your saved folders and then when you select one, and moves all the items that were selected to the selected folder.


I'll take a look at getting this worked out for ya.

Link to comment
  • 3 weeks later...

I would love this. currently using an automater app hidden in the library with an automater workflow to run ( and notify because it can :D) but I would love this workflow. Have been a powerpack user since early on in V1 and love alfred.

Link to comment
  • 5 months later...

Hi David,


this is exactly what I'm looking for. I want to select files in finder (pathfinder) and then hit a hotkey, get the alfred folder selection (not a pre-defined list!) and then move the files in the selected folder.


I've tried to put it together myself, but failed ;-( Can you help?


Thanks and best regards!

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...