dropping files simultaneously to multiple folders

i’m trying to move files in two directions at once (almost), then delete the originals. am i on the right track?

set x to ((path to desktop folder as text) & "test:1:") as string
set y to ((path to desktop folder as text) & "test:2:") as string
set z to ((path to desktop folder as text) & "test:")
set theFolders to {x, y}
set theFist to (list folder z without invisibles)
set theFiles to (choose from list theFist with multiple selections allowed)
repeat with i in theFiles
	tell application "Finder"
		set xx to ((z as text) & (item i of theFiles))
		repeat with q from 1 to (count of theFolders)
			duplicate file xx to q with replacing
			delete xx
		end repeat
		
	end tell
end repeat

i’d like to move the files from a local folder (acting as a FTP dropbox) to a drop folder on an appleshare volume and a local backup folder. i was using the preceding script to see if i could do it on a smaller scale. this will eventually become part of a folder action that already works fine.

thanks for any help.

Hi :slight_smile:

It seems to me that you have any errors of syntax in the loops, here the correction:

set x to ((path to desktop folder as text) & "test:1:") as string
set y to ((path to desktop folder as text) & "test:2:") as string
set z to ((path to desktop folder as text) & "test:")
set theFolders to {x, y}
set theFist to (list folder z without invisibles)
set theFiles to (choose from list theFist with multiple selections allowed)
if theFiles is false then error number -128
repeat with i from 1 to (count items of theFiles)
	tell application "Finder"
		set xx to ((z as text) & (item i of theFiles))
		repeat with q from 1 to (count items of theFolders)
			duplicate file xx to folder (item q of theFolders) with replacing
		end repeat
		delete file xx
	end tell
end repeat

:slight_smile:

thank you, sir. i was befuddled.