Choose folder from dropdown list, move file

My goal is to move my selected file to a destination folder. Of course, the destination folder has a bunch of subfolders… how can I write a script that will present me with a list of those subfolders, allowing me to determine exactly where to move my file to?

I can get an alias list of the subfolders (which I think is needed for the move operation??), and I can get a list of the subfolder names as text (which I think is needed for the dropdown list??), but I don’t know how to make them play together.

Any help is much appreciated!


there are a lot of different solutions, I prefer this one

set baseFolder to path to home folder

tell application "Finder"
	set selectedItems to selection
	set folderList to (every folder of baseFolder)
end tell
set nameList to {}
repeat with i from 1 to (count folderList)
	set end of nameList to (i as text) & tab & name of item i of folderList
end repeat
set chosen to choose from list nameList
if chosen = false then return
set chosenIndex to 1st word of item 1 of chosen as integer
tell application "Finder" to move selectedItems to item chosenIndex of folderList

“Here’s one I did earlier”.
Save as application, and put in Finder toolbar.

	Move item
	a droplet to put into the Finder's button bar

on run --double-clicked
	display alert "I am droplet!" message "Drop things on me to make me work."
end run

on open (theItems) -- dropped-on
	-- ask for destination
	set theDestination to choose folder with invisibles -- alias
	goToWork(theDestination, theItems) -- aliases
end open

on goToWork(theDestination, theItems)
	repeat with anItem in theItems
		tell application "Finder"
				move anItem to theDestination
			on error errMsg number errNum
				if errNum = -15267 then
					display alert "Item exists!" message "Replace it, or leave alone?" buttons {"Leave", "Replace"} default button 2
					set userChoice to the button returned of the result
					if userChoice is "Replace" then
						move anItem to theDestination with replacing
					end if
					display dialog (errNum as string) & return & errMsg
				end if
			end try
		end tell
	end repeat
end goToWork

I’ve used this for almost a year, so I’m pretty sure it doesn’t eat files :smiley:

Thanks to both, everything’s running as desired :smiley: