The target file "D:\Users\user-pc\Desktop\testing\dest" is a directory, not a file.

c#, file

Solution

File.Copy expects as destination a file name, not a folder name.

Change to this:

File.Copy(fileArray[i], Path.Combine(dst, Path.GetFileName(fileArray[i]));

Problem

i have a problem when i try to get some files from a dirrectory it selects the dirrectory and gives me an error: The target file "D:\Users\user-pc\Desktop\testing\dest" is a directory, not a file. c# ( i am giving the program only the path that i copy from the file explorer) The code: ``` string[] fileArray = Directory.GetFiles(src, "*.txt"); for (int i = 0; i < fileArray.Length; i++) { File.Copy(fileArray[i], dst); } ```

Original source