Script to move files to another folder started by cron

Hi,

I have Folder action script that moves all .ps files to another folder.
Now I want to make script that I run from cron and it moves all .ps files to another folder. I also want them to be moved at same time (not one by one).

How can I do that (I know how to run script from cron but I don’t know how to select .ps files and move all)?

Here’s my action script:


property next_in : "M204:Users:jl:Desktop:In"
property ps_ext : "ps"
property pdf_ext : "pdf"
property log_ext : "log"

on adding folder items to this_folder after receiving these_items
	tell application "Finder"
		try
			repeat with i from 1 to number of items in these_items
				set this_item to item i of these_items
				if the name extension of this_item is ps_ext then
					duplicate this_item to next_in
				end if
			end repeat
		end try
	end tell
end adding folder items to

Thanks

Jukka

After modifying line 2 in the Finder code to reflect the local folder, does this work?

property next_in : "M204:Users:jl:Desktop:In"
property ps_ext : "ps"

tell application "Finder"
	set these_items to files of folder "path:to:folder:" whose name extension is ps_ext
	try
		duplicate every item of these_items to folder next_in
	end try
end tell

– Rob

If you are comfortable setting up cron, why not just give it a command to run like “mv /startPath/*.ps /endPath/”? You can use MvMac if you installed Developer tools (It keeps the resource forks happy).
It’s things like this that have prompted me to learn more about the shell and less about AppleScript. Of course I did not know there was a name extension property(?) in Finder… but it seems that the many lines you need to do it in AppleScript are too many compared to one command like above.
fwiw
Ian