Domanda

I am copying some folders with:

My.Computer.FileSystem.CopyDirectory(folder, destination)

And they obviously do have content. So I want to skip the duplicate files, how do I do that?

Thanks in advance,

Luca

È stato utile?

Soluzione

You could try setting the parameter overwrite to false

My.Computer.FileSystem.CopyDirectory(folder, destination, false)

This will raise an exception when, in the destination folder, a file to be copied exist, but the missing files in the destination are still copied.

See the documentation on CopyDirectory(source, dest, overwrite) to know how to handle the exception

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top