Jump to content

Copy/Move To and Alfred Browser Workflows


Recommended Posts

Hi,

 

Just uploaded two new (old for me) workflows that I find very useful and thought someone else might like them. They are:

 

Copy/Move To Workflow

This workflow starts with a "Add Directory to Copy/Move locations..." File Action to create a list of directories to use as targets for a copy/move operation. If actioned on a file, the directory of the file is saved.

Once you have a list, you can use "copy to..." or "move to..." file actions to move or copy files to a previously saved directory.

The keyword "cm:fav" is used to view saved directories, remove one, go to one in Alfred Browser, open in Finder, or go to in terminal/iTerm depending on your terminal preset in Alfred.

 

Alfred Browser Toolbox

 
Keywords
 
ff
 
It is a way to lookup a folding in the Alfred browser or in Finder. Very handy.
 
ab:newfile
 
Creates a new file in the directory of the topmost Finder, Commander One, or Path Finder window.
 
ab:newdir
 
Creates a new directory in the directory of the topmost Finder, Commander One, or Path Finder window.
 
ab:open
 
Opens the URL, URI, or file given using the Mac OS X open terminal command. This has a hot key as well to open the current selection with "open".  This works with Finder, Path Finder, and Commander One.
 
ab:pdf
 
This is a file filter for PDF files. I have many and this really makes finding them easy.
 

ab:cparent   

 

This command will get the currently selected file in Finder, Path Finder, or Commander One and copy it to the parent directory. Works on files or directories. This has a Hotkey as well.

 

ab:mparent   

 

This command will get the currently selected file in Finder, Path Finder, or Commander One and move it to the parent directory. Works on files or directories. This has a Hotkey as well.

 

ab:cfile      

 

This command will copy the contents of the file to the clipboard. You need to be sure it is a text file. This has a Hotkey as well.

 
Alfred Browser Actions
 
Get File Name
 
This gets the name of the file selected in Alfred Browser and puts it into the clipboard.
 
Get File Size
 
This gets the file size of the file selected in the Alfred Browser and puts it into the clipboard.
 
Create a File
 
Simply creates a file in the directory this file action is ran on. It will ask you for the name and then create it.
 
Create a Directory
 
Same as "Create a File", but creates a directory instead.
 
Copy Relative Home Path
 
This file action calculates the relative path from the user’s home directory and copies it to the clipboard.
 
Paste Relative Home Path
 
This file action copies the absolute path to the clipboard. It will then paste the relative path to the topmost application.
 
Copy Absolute Path
 
This file action copies the absolute path to the clipboard.
 
Paste Absolute Path
 
This file action calculates the relative path from the user’s home directory and copies it to the clipboard. It will then paste the relative path to the topmost application.
 

Copy/Move to Parent Directory

 

These two actions will copy/move the selected file to the parent directory.

 

Copy File Contents to Pasteboard

 

This action will copy the contents of the file to the pasteboard.

 

NOTE: Currently this requires OS X 10.10 because I am using JavaScript for Automation that is only in 10.10. Sorry!

 

Version: 1.5

Date:      12/04/2015

 

You can get them from my Github account: https://github.com/raguay/MyAlfred

or Packal:

 

http://www.packal.org/workflow/copymove

http://www.packal.org/workflow/alfred-browser-toolbox

Edited by raguay.customct
Link to comment

It looks like an awesome workflow. Unfortunately, I couldn't make it work.

 

Got the error: 

Starting debug for 'Files - Copy/Move to'

[INFO: alfred.workflow.trigger.action] Processing output 'alfred.workflow.action.script' with arg '(
    "NAME_OF_A_FILE_LOCATED_IN_THE_DOWNLOADS_FOLDER.pdf"
)'
[ERROR: alfred.workflow.action.script] Code 0: GetName.scpt: script error -1762.  Couldn't get error text because of error -1700.
[INFO: alfred.workflow.action.script] Processing output 'alfred.workflow.output.notification' with arg 'Just added: 
'

Downloaded from packal (v1.1)

OSX 10.9.5.

Link to comment
  • 5 weeks later...

#feedback 

 

Apparently, the workflow doesn't like , or ( ) or [ ] in file names :)  / Exotic files types like .chm files.

 

I couldn't copy one file with an exotic name. It included [ ] -> Error: No such file or directory.

 

I couldn't move the .chm file -> Error: No such file or directory

 

Very useful workflow. Thank for sharing. 

Edited by politicus
Link to comment

Hi, I can not reproduce your error. Is it the copy or move function? Is it the source or destination? All of my destinations have spaces and parenthesis and true files should not make a difference. But, files that are really directories will not work since I am just using the standard unix cp command.

 

I will experiment with making the cp function recursive and see if that helps. Update soon...

Link to comment

@raguay.customct 

 

After I installed the latest version of the workflow, some of the "saved destination directories" ( = directories I added to to Copy/Move locations...) of the previously installed version of the workflow were still there. Looks like they are cached somewhere and not purged yet.

 

The delete command of the cm:fav command didn't help me delete them as it threw an error message "strpos(): Empty needle i...".

 

I didn't log out from OS X Yosemite. 

Link to comment
  • 2 weeks later...

Tried the 1.4 version (from Packal).

 

1°) The cm:reset action is working like a charm.

 

2°) I couldn't perform a delete action on a directory list item. In Alfred's debug mode, I got the error: 

Starting debug for 'Files Copy/Move to'

[ERROR: alfred.workflow.action.script] Code 0: 2015-01-05 11:02:10.482 osascript[5157:307793] warning: failed to get scripting definition from /usr/bin/osascript; it may not be scriptable.
Link to comment

Okay, I found the bug in the copy/move for removing the directory from the list. The php strpos function did not do what I expected. I am now using strcmp and it seems to be working better. Not sure what your error message is coming from as that section of code doesn't use osascript. It is updated on Packal and my GitHub. Please redownload and give it a try.

Edited by raguay.customct
Link to comment
  • 2 weeks later...
  • 3 weeks later...

Perhaps I am missing something, how do I choose what directories I can copy/save to?

 

When you are in the Alfred prompt, go to the Alfred Browser by typing in a path (ie: ~ for home). Move around to the directory you want to mark as a favorate and press right arrow. That brings up a list of possible actions. Type "Add" and select the "Add Directory to Copy/Move locations". Now, when you use the copy/move functions, that directory will show up as a possible destination.

Link to comment
  • 6 months later...
  • 5 weeks later...
  • 4 weeks later...
  • 1 month later...

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