Writing to a list of files

I have what I thought would be a simple problem to script, but I’m stumped and could use some help.

I have a directory of 0 byte files (a dummy list of files) that I need to add a little “something” to so that they are not 0 byte files any more.

I am trying the following code but it does not write to the files.

set sourcefolder to choose folder
tell application "Finder" to set workFiles to sourcefolder
repeat with currentFile in workFiles
	set ff to (open for access file currentFile with write permission)
	try
		set eof ff to 0
		write "Text" to ff
	end try
	close access ff
end repeat

Any help would be GREATLY appreciated!

Thanks!
Tom

Hi,

2 problems:
you need a list of files

tell application "Finder" to set workFiles to files of sourcefolder

and you have to coerce the Finder file specifier to text

set ff to (open for access file (currentFile as text) with write permission)

the keyword file is confusing, AppleScript’s file and Finder’s file is not the same

Thank you SO much Stefan! I struggled and searched the web for quite a while to get where I was and knew I was close. I really appreciate your help!!!

Tom