finished moment of file copy in a folder

Hello all,

Is there a way in Applescript to determine when a file copied ( not moved ) into a folder is finished?
It is no problem to use a folder action or even launchd, but it should activate an applescript script.

Someone any experience or idea’s?

Thanks

Hello.

There is some really good posts about busy files here. Try using those words as search criteria and see what shows up. Search for posts by Adam Bell as well -I remember seeing his name in connection with this topic.

As long as a file is not totally downloaded or copied over a server volume, its status is busy, which is a property of one of the files. -But as I can recall: it isn’t really that simple. But all that you need to know is here, -you just have to find it.

Best Regards

McUsr

hi,

you could put the try-block in a handler …

set aFileAlias to choose file
try
	--... Lsof lists information about files opened by processes ...
	do shell script "lsof " & quoted form of (POSIX path of aFileAlias)
	-- still busy
	return true
on error
--ready
	return false
end try

P.S. just remembered where i found it once: http://www.hohabadu.de

Hello.

I just wanted to add that as of Snow Leopard you don’t need to give POSIX path an alias, a path or filename in text will suffice.

Where that leaves us regarding backwards compatibility is a whole different matter.

Best regards

McUsr (with a now little bit bigger and more useful System library! :slight_smile:

Thank you all for the current replies. But, like lsof and fs_usage give reply even when the file is or get selected in the finder. I did those things before. But I keep searching and trying. I will check for the options.

Thanks again

I was thinking kind of similar thoughts yesterday.

Well, then you have to investigate the busy state, or not select the file while it is being downloaded.

Best Regards

McUsr