Answers for "c# file move"

C#
1

move file c#

// Move the file.
//File.Move(from,to)
File.Move(@"c:\temp\MyTest.txt", @"c:\temp2\MyTest.txt");
Posted by: Guest on June-06-2021
0

move file c#

for (int i = 1; i < n; i++)
{
    try
    {
        from = System.IO.Path.Combine(@"E:\vid\","(" + i.ToString() + ").PNG");
        to = System.IO.Path.Combine(@"E:\ConvertedFiles\",i.ToString().PadLeft(6,'0') + ".png");

        File.Move(from, to); // Try to move
        Console.WriteLine("Moved"); // Success
    }
    catch (IOException ex)
    {
        Console.WriteLine(ex); // Write error
    }
}
Posted by: Guest on March-16-2022

C# Answers by Framework

Browse Popular Code Answers by Language