This is not easy task, you have to manually do this, unless someone tells any code for this...
If you have two similar lists in two different site-collections in SharePoint and want to copy an existing workflow from site A to site B you can follow the procedure below.
So, to achieve the same follow the steps below.
- In the first(source) site, create the required workflow and publish
it.
- Now select Export to Visio option which allows you to save the
workflow with a .vwi extension. (Refer this workflow hereafter as
source workflow).
- Now go to the destination site where you want the workflow to be
copied, and create a new workflow with the same name as the previous
one & publish it.
- Now select Export to Visio option which allows you to save the
workflow with a .vwi extension. (Refer this workflow hereafter as
Destination workflow).
- Now you will be having two .vwi files (one of source workflow’s –
SourceWorkflowName.vwi and other of the destination workflow’s –
DestinationWorkflowName.vwi). Now add .zip extension to both the
files. Now your files names should be SourceWorkflowName.vwi.zip &
DestinationWorkflowName.vwi.zip.
- Now open both the zip files, copy workflow.xoml.wfconfig.xml from
destination workflow to source workflow. (Its destination to source
and not source to destination).
- From now on, we will not use the file
DestinationWorkflowName.vwi.zip. So ignore that file.
- Remove the .zip extension from SourceWorkflowName.vwi.zip which
gives you the SourceWorkflowName.vwi file.
- Now, go to the destination site, open workflows and click Import
from Visio and browse to the SourceWorkflowName.vwi file.
- That’s it and your workflow is copied. You can publish the workflow
and run it.
Note: In case if your list’s GUID’s (for those lists that you have used in workflow – tasks list, history list or any other lists used in workflow steps) have been changed from source & destination site, you may need to update those steps in the workflow.
http://chanakyajayabalan.wordpress.com/2012/01/02/copyingmoving-sharepoint-2010-designer-workflows/
http://sharepoint-community.net/profiles/blogs/how-to-copy-workflows-from-one-site-collection-to-another-with
Or Use this Codeplex solution Sharepoint Workflow Migrator
http://blogs.technet.com/b/sharepointwarrior/archive/2012/03/14/sp-2010-how-to-copy-workflows-from-one-site-collection-to-another.aspx