Moving HTML files to a new folder for collection

I’ve searched the web to no avail. I need a simple Applescript that would move an html file from one folder and move it to another folder for collection. Seems simple enough to do, but I may be wrong. I’m not a pro at applescripting and would appreciate some help.

Thanks in advance for any assistance

Folder actions work only on a change to a folder. See this Apple web page for info:
Folder Action Intro
If there is a file in a folder already and you want to move it you can take a look at this topic on the bbs:
http://bbs.applescript.net/viewtopic.php?t=6826
So I guess what I’m saying is, you’re going to have to give us a little more info about your situation for us to be able to give you a better answer. :slight_smile: Is this html file being added to a folder or is there a folder event happening that can trigger a folder action?

Let me try to give some more detail.

I have a game that produces a stat sheet at the end of every game played.
It is generated as a .htm file, and is placed in a folder.
Once the game is restarted and played again, the stat .htm file is replaced by a new one and the stats from the previous game are lost forever.
I would like to have an Applescript that would move a copy of the stat .htm file to a folder
at the end of each game.
That way, I could archive and compile the stats at a later date.

Any assistance would be greatly appreciated.
Thanks again

Are the htm files given unique names? If not, they will have to be renamed before moving or duplicating them. How do you want to handle that?

– Rob

the name of the file remains the same: “missionstats.htm”
It is replaced each game with a new version.

Hope this helps
Thanks again

I have no problem with renaming the files or keeping the same name.
It’s the stats that are important.

Thanks

Maybe this will work. It will duplicate and then delete the missionstats.htm file. It’s necessary to delete the file so that the folder action will be triggered each time a new file is created. The duplicates will be created in the same folder as the original, with interesting names such as missionstats copy.htm, missionstats copy 1.htm, missionstats copy 2.htm, etc.

on adding folder items to this_folder after receiving added_items
	repeat with item_ in added_items
		if name of (info for item_) is "missionstats.htm" then
			tell application "Finder"
				duplicate item_
				delete item_
			end tell
			exit repeat
		end if
	end repeat
end adding folder items to

– Rob

Rob, you rock. Thanks…I will give this a shot and give you an update on my progress.