Move files to specific folders with Csharp

How can I move files (via paths) to specific folders, I have a large number of rhino files, and I can sort it with data tree, but then I need to move it to their target folders.
I think this could solve with csharp. Any advice would be helpful.
this is the basic idea

– Dale

Just trying the same here and I can get to move the files, but not if they already exist.

The File.Move mentions that there is not just

Move (string sourceFileName, string destFileName);

but also:

Move (string sourceFileName, string destFileName, bool overwrite);

Trying this I get the error:

Does that mean we can’t access this function?

Can your post a .gh file with your C# component?

– Dale

Sure, I can, but I think I got it now.

That move with the boolean parameter for overwrite is only available in .net 5.0 and up, but it seems in GH we have .net 4.0!?

I solved it now by checking if a file exists and if it does I delete it before moving the file.