folder action to import e delete files

Hello world!!

this is a fantastic software for me, very useful to organize my life!!

I have a little request…i found in the EXTRA folder the folder action script to attach to a folder.
It works very well but the script not delete the files after importing in devonthink…is possibile to delete the entire content of the folder?

thanks a lot.
Andrea

Yes, but it’s usually not prudent to tell a routine that is doing something with files to delete them after a step in the procedure, as something could go wrong.

It would be easy to use Automator to delete the contents of that folder. Note that there are example Automator actions in the Extras folder on the download disk image.

Personally, I just manually dump the contents of my Folder Action folder to the trash once in a while. :slight_smile:

I slightly edited a folder action to do this, actually. It also works around a problem I had with stuff failing to import by adding some delays. Mildly annoying, but until I figure out how to stop folder actions from acting on a file until I’ve finished writing to it, it’s just going to have to do.

Whoa. This script is over five years old.


-- Action Import.applescript
-- DevonThink Pro
-- Created by Christian Grunenberg on Tue Dec 03 2002.
-- Copyright (c) 2002-2005. All rights reserved.

on adding folder items to this_folder after receiving added_items
	try
		tell application "DEVONthink Pro" to launch
		repeat with theItem in every item of added_items
			try
				set thePath to theItem as text
				if thePath does not end with ".download:" then
					delay 10
					tell application "DEVONthink Pro" to import thePath
					delay 5
					tell application "Finder" to delete theItem
				end if
			end try
		end repeat
	end try
end adding folder items to

Edit: There’s no easy way to tell whether a given file is open, and so I’m not going to bother. I just throw in this delay for printing to PDF.

kalisphoenix it works fine. thanks a lot and best time. Andrea