Without writing all the code for you, I point you in a general direction. There is one question also, when you say the agent needs to run on both new and old documents, do you mean run on the new ones as they come into the database, or just like how it is done for the old (already existing) ones? If you need something that can be triggered at anytime on the existing ones and on new ones as they come in, you will likely need to have 2 agents. One that is run from an action button or the action menu, and the other scheduled Before new mail arrives. An agent that is scheduled (like Before new mail arrives) cannot use any reference to UI objects. I would recommend you write the this one time, so write a script library to house all the code using backend objects only. Then you can reference it in either agent. You need to use the NotesEmbeddedObject object and NotesRichTextItem object to get to attachments in a document. Once you have these, as long as the system you are working from has the ability to get to the folder(s) you want to store the attachments to, then this will work. This means your server has to be running using a domain account, and that domain account has to have access to the area(s) you want to copy files to – only for the Before new mail arrives agent though. If the agent is started by an action button or from the action menu by a user, then the user triggering the action must have access to the area(s) where the attachments are going to be stored. If you need further assistance, I can help, but send me the code you have tried and we can see if we can work it out. I can also be contracted for help as well.