Tell me, please, in the array there are full paths to the files and you need to move files from the specified array to newPath . How can this be implemented?

 string[] NewFile = File.ReadAllLines(@"C:\Test1\1.cfg", System.Text.Encoding.Default); string newPath = @"С:\Test2\"; 

    1 answer 1

    A foreach through the array of paths followed by a call to File.Move on each element of the array. The second argument to File.Move is Path.Combine(newPath,Path.GetFileName (элемент массива))

    • So it turns out the first argument is an element of the array? - Jeronwen
    • Something like this. I would try / catch would add. - iluxa1810
    • So, okay, what if you write "FileNotFoundException"?) - Jeronwen
    • @Jeronwen, it is obvious that the file that you want to transfer from one place to another, it is not in the original place. - iluxa1810
    • Well, this is logical, but the file is there - most likely the problem is in rights. - Jeronwen