C# : FTP How to identify 550 ftp error ,the Directory already exists or Directory not found

StackOverflow https://stackoverflow.com/questions/4841678

  •  27-10-2019
  •  | 
  •  

문제

C# : FTP How to identify 550 ftp error ,the Directory already exists or Directory not found. Because 550 is can be both of them.

도움이 되었습니까?

해결책

Directory already exists can only happen when you're trying to create a directory. So if you're creating a directory and you get a 550, then that's the one.

Directory not found can only happen while browsing to a directory. So again this is easily identifiable given what action you where doing.

다른 팁

Simple answer is: you can't. Even if "directory already exists" can only happen when you are trying to create a directory, it may still return 550 for other reasons such as a missing or otherwise unaccessible parent directory.

The best you can do is to check for a return code of 550, and then check if the directory made it there by requesting its file listing. If it already exists, you'll get a listing, if not, you'll get an error.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top