을 작동시킬 수없는, 그건 그냥 작동하지 않습니다File.Copy이 다른 파일 위치, Microsoft에서 코드 샘플입니다
string fileName = "test1.txt";
string sourcePath = @"C:\";
string targetPath = @"C:\Test\";
// Use Path class to manipulate file and directory paths.
string sourceFile = System.IO.Path.Combine(sourcePath, fileName);
string destFile = System.IO.Path.Combine(targetPath, fileName);
System.IO.File.Copy(sourceFile, destFile, true);
이 소스를 찾을 수 없습니다 파일. 내가 브레이크 포인트를 설정하면, 이것은 내가 무엇을 얻을 수 있습니다 : 그대로 문자열을 사용하는 경우에도 백 슬래시를 두 배로처럼
args {string[0]} string[]
fileName "test1.txt" string
sourcePath "C:\\" string
targetPath "C:\\Test\\" string
sourceFile "C:\\test1.txt" string
destFile "C:\\Test\\test1.txt" string
그래서이 보인다. (내가 C에서 test1.txt 파일을 가지고 있다는 것은 의심의 여지가 없다 :) 어떤 아이디어? 감사!
예외 메시지 및 스택 추적이란 무엇입니까? – SLaks
백 슬래시를 두 배로 늘리는 것은 디스플레이 용입니다. 어떤 오류 메시지가 나타 납니까? –
예외 텍스트를 게시 하시겠습니까? 두 개의 백 슬래시가 좋습니다. – Matten