It’s actually quite easy if you can write some SQL. Use SQL to generate two files - once that matches the DMT Attachments format and is used/set to Delete attachments.
The second file is a CSV that includes all the metadata needed for ECM to import and run a simple Workflow that will attach the document back to Kinetic. I’ve done this plenty of times. Easiest way is to pull the XfileRef and XfileAtach tables together (along with whatever source tables you need to get other metadata) and include the path to the filestore(d) file and GUID to the source transaction line it should be attached to.
Take a look at those tables and your files, but the SQL looks something like this. NOTE - this uses a custom function and is for my Sharepoint attached files, not filesystem, but the gist is clear enough.
select fa.RelatedToFile
, [Content Type] = concat('ORDER','_', c.company)
, Ordernum = fa.key1
, CustID = c.custid
, Customer = c.name
, c.custnum
, [_TableName] = 'Orderhed'
, [_TableSysRowID] = c.SysRowID
, [_EpicorDocTypeID] = 'Order'
, [Schema] = 'ERP'
, Company = c.company
, Title = case when left(xfilename,4)='http' then dbo.ashgetfilenamefromurl(xfilename) else dbo.ashgetfilenamefrompath(xfilename) end
, ashworthutility.dbo.fn_FileExists(dbo.AshConvertAttachmentPath_SP(xfilename))
, [FileName] = dbo.AshConvertAttachmentPath_SP(xfilename)
, XFileName
, [_Comments] = 'Imported from Epicor'
, [ReplacedXfileRefNum] = fa.XFileRefNum
--,*
--, FileExists = ashworthutility.dbo.fn_FileExists(dbo.AshConvertAttachmentPath_SP(xfilename))
--, fr.DocTypeID, fa.key2, fa.key5, cr.key1, cr.Key2, xfilename, xfiledesc, fr.DocTypeID, dt.Description, dt.StorageType
from ice.XFileAttch fa join ice.XFileRef fr on fa.XFileRefNum=fr.XFileRefNum and fa.Company=fr.Company
left join erp.OrderHed oh on fa.ForeignSysRowID=oh.SysRowID and oh.company=fa.Company
left join erp.customer c on c.company=oh.company and c.custnum=oh.custnum
left join ice.DocType dt on fr.DocTypeID=dt.DocTypeID and fr.Company=dt.Company
where xfilename like 'http://ashepicsps/200/Orderhed/%'
--and fa.relatedToFile='customer'
--and ashworthutility.dbo.fn_FileExists(dbo.AshConvertAttachmentPath_SP(xfilename))=1
order by fa.key1