Jump to content

Remove folders from buffer


Recommended Posts

Hi all,

 

 I'm new to Alfred. I'm building a workflow to clear my desktop when it becomes too cluttered. The steps so far are:

1. Keyword

2. Automation task: list folder contents ~/Desktop

3. File buffer

 

 

 That works great, but I'm struggling to find a way to filter the Desktop contents so that folders don't get placed in the buffer, or alternatively remove them once added.

My plan is to move all the buffer contents to particular folders on the Desktop based on their file type, but I need to remove the folders first.

Any ideas will be much appreciated.

Link to comment

Welcome @vquest,

 

Between the second and third step add a Run Script. Leave the settings to the default and use this in the Script box:

 

function alfred_args {
  /usr/bin/osascript -l JavaScript -e 'function run(argv) { return JSON.stringify({ alfredworkflow: { arg: argv } }) }' "${@}"
}

files=()

for input_path in "${@}"
do
  [[ -f "${input_path}" ]] && files+=("${input_path}")
done

alfred_args "${files[@]}"

 

This will be made into an Automation Task in the next release.

Link to comment
8 hours ago, vitor said:

Welcome @vquest,

 

Between the second and third step add a Run Script. Leave the settings to the default and use this in the Script box:

 

This will be made into an Automation Task in the next release.

 

One thing to be aware of when building the Automation Task is that the script didn't filter out alias folders that I had on the Desktop. I'm guessing probably because alias folders are actually just files that link to a folder elsewhere.

Link to comment

I have a question about the get matching argument automation task. Is it possible to have an array of regular expressions in a single task? If so, how is it written? I have tried commas and a few other things, but without success.

 

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