Hello,

I am trying to send files from one folder on the C drive to another using a simple C# Win forms. I have created this but unable to get it working. Can anyone help?

private void butSort1_Click(object sender, EventArgs e)
        {
            string sourceFile = @"C:\Test\test.txt";
            string destinationFile = @"C:\Test1\test.txt";

            try
            {
                System.IO.File.Move(sourceFile, destinationFile);
            }
            catch (Exception except)
            {
                lblErrors.Text = except.Message;
            }
        }

EDIT : duplicate

Perhaps reading this can give you some hints to solve your problem.

Specify if there any errors or the exception Message

Sorted it. Debugger was playing up so the code is fine. Cheers.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.