Folder Action Problem

i’m trying to write a simple folder action script to move all files that start with a “k” to another folder, and i keep getting error messages. i was able to make a script that would move all files put into one folder to another folder, but i’m having trouble with the properties part of it…

here’s the script:

on adding folder items to this_folder after receiving added_items
repeat with added_item in added_items
if added_item’s name begins with “k” then
tell application “Finder”
activate
move added_item to folder “aaaaa”
end tell
end if
end repeat
end adding folder items to

i definitely deserve a :oops: for this one

Your code was complete but it needed a slight adjustment. This might work.

on adding folder items to this_folder after receiving added_items
	tell application "Finder"
		activate
		repeat with added_item in added_items
			if added_item's name begins with "k" then
				move added_item to folder "aaaaa"
			end if
		end repeat
	end tell
end adding folder items to

– Rob

works great…thanks rob! :wink:

the only problem i’m having now is that this folder action is being placed on a folder on a server on my network, and i want the folder action to move the files from the server (call it “srv1”) into a folder that’s on my hard disk. can it do that?

thanks again!

The Finder can’t move the files from one disk to another (as far as I know) but it should be able to duplicate them and then delete the originals.

on adding folder items to this_folder after receiving added_items
	tell application "Finder"
		activate
		repeat with added_item in added_items
			if added_item's name begins with "k" then
				duplicate added_item to folder "path:to:srv1"
				delete added_item
			end if
		end repeat
	end tell
end adding folder items to

– Rob

it doesn’t give me any error messages, but at the same time nothing happens.

i named my computer “ENA01”, so i figured that:

duplicate added_item to desktop of disk “ENA01”

would be the correct path…am i wrong??

thanks again rob! :wink: