cancel
Showing results for 
Search instead for 
Did you mean: 

Copy files in KM without overwrite

Former Member
0 Kudos

Hello,

How can I copy files in KM without overwrite the content?

I think the copy() method of IResource, overwrite content...

i.e.:

There is a source folder with FileA & FileB.

The destination folder has FileA.

I need to copy just FileB, no overwrite FileA.

It's possible? This is an example, in my case I will copy hyndreds of files and I need this validation.

Thanks!!!

Accepted Solutions (0)

Answers (1)

Answers (1)

christiansche
Active Participant
0 Kudos

Hi,

you can use this code:



IResourceList resList = folder.getChildren();
RID fileRid = RID.getRID(kmFolder + "/" + element.getFilename());

IResource fileRes = factory.getResource(fileRid, context);

if (fileRes != null) {
	if (!resList.containsResource(fileRes)) {
IResource newResource = folder.createResource(element.getFilename(), null, content);
	}
}

instead of my createResource you can probably use the copy method.

Best regards,

Christian