Help please - Need a simple "Move to Folder" macro

I’m under the gun to sort thousands of files in various folders, moving so9me to a separate “keeper” folder.

I’ve been trying to understand some of the existing library macros but I have to admit, they’re way over my head.

Here’s how I think it might go.:

  1. In the macro itself, I’d identify the folder I want to move the selected items to. (the “keeper” folder)
  2. I open one of the folders with files to be sorted and click the first one.
  3. I arrow key down the list of files to each file in sequence.
  4. When I come to a file to be kept, I enter the hot key, the file is moved to the previously determined folder and the next file in folder I am sorting is selected.
  5. I keep using the arrow key or macro hot key until I come to the end of the files in that folder.
  6. I choose the next folder to sort. (and edit the destination folder if needed).

When I finish, I will have “keeper” folders with selected files and folders with files not needed.

Can someone please write this for me or guide me to an existing macro?

Thank you so much,

Chris

Hey Chris,

Do you just want to associate ONE keeper-folder per macro?

And move any selected items in the Finder to that folder?

-Chris

Hi Chris,

I'm sure @ccstone will have a much better solution for you once you share the details he asked for, but in the meantime, I can tell you that what you want to accomplish is very easy once you know how to set it up. In fact, it can be accomplished with a single action. Here's a sample macro that will move any currently selected files to your desktop by pressing F5:

Move Selected Files To Desktop.kmmacros (2.3 KB)

And here's what it looks like:

You can of course change the hotkey and the destination folder to suit your preferences once you've imported this into your macro library. Admittedly, this sample solution does lack a way to automatically select the next file after the current selection is moved, but this should get you most of the way to your goal, and I'm sure one of the other, more experienced posters here can readily assist with that last part. I hope this helps!

Yes, Chris. one keeper folder per macro. I might go through 5 different
folders but the keeper files from each of the 5 would all go to 1
predetermined folder.

And I guess the instruction in the macro would be tp[ highlight the next
file.

Could this throw a problem if the previous file is no longer in the folder
so the Finder can move from moved file to the next file?

Thanks,

Chris

Hey Chris,

Yes.

When you move a file with a script or with Keyboard Maestro the selection is destroyed, and the system isn't smart enough to fix it.

This AppleScript will move the selected items (one or more) to the designated destination folder, and it will select the next available item in the working folder.

It's fast - even in a folder with a thousand items.

------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2017/02/26 21:26
# dMod: 2017/02/26 22:10
# Appl: Finder
# Task: Move selected items to a designated folder and SELECT next available item if possible.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Finder, @Move, @Selected, @Items, @Designated, @Folder
------------------------------------------------------------------------------
(*

NOTES:

#### Target folder MUST be sorted by NAME for select-next-item to work properly. ####

*)

-------------------------------------------------------------------------------------------

# Alias -- User Setting
set destinationFolder to alias ((path to home folder as text) & "test_directory:Destination_Directory:")

------------------------------------------------------------------------------
# HFS Path String
set destinationFolderPath to destinationFolder as text

tell application "Finder"
   set winTarget to insertion location as alias
   set finderSelectionList to selection as alias list
   
   if finderSelectionList = {} then
      beep
      return
   end if
   
   set winTargetItemNameList to list folder winTarget without invisibles
   set itemName to name of (last item of finderSelectionList)
   set AppleScript's text item delimiters to itemName
   move finderSelectionList to destinationFolder
   delay 0.05
   set AppleScript's text item delimiters to linefeed
   set winTargetItemNameList to winTargetItemNameList as text
   set AppleScript's text item delimiters to itemName
   set winTargetItemNameList to text items of winTargetItemNameList
   
   if length of winTargetItemNameList = 2 then
      
      try
         
         set winTargetItemNameList to item 2 of winTargetItemNameList
         repeat while character 1 of winTargetItemNameList is linefeed
            set winTargetItemNameList to text 2 thru -1 of winTargetItemNameList
         end repeat
         set itemName to paragraph 1 of winTargetItemNameList
         set selectItemPath to ((winTarget as text) & (paragraph 1 of winTargetItemNameList)) as alias
         tell front window to select selectItemPath
         
      end try
      
   end if
   
end tell

------------------------------------------------------------------------------

If you don't know how to create a proper alias for your destination folder then look at this:

Putting File Aliases On The Clipboard

Remember to use the Script Editor.app when testing AppleScripts before placing them in an Execute an AppleScript action.

-Chris

Here’s another way posted as an instructional example:

[FINDER] Move Selected Finder Items to Choose Folder Example

Also there is a built in way to move a file I’m finding handy when you have a file open in the Finder.

Clicking on the downward pointing reveal arrow to the right of the file name at the top of the window drops down a menu to rename the file or if you click in the Where: current folder location you can simply click on a folder location listed to select a folder to move to. The second dropdown menu lists your Finder favorite folders so frequently used folder are at hand. At the bottom of the list is an Other… item that when clicked opens a standard nav dialog within which you can get to any folder.