Reputation: 21
Here is my code;
string filedate = "ftp://72.242.29.132/TestArca/Test" +directories[i].ToString();
int j = filedate.IndexOf(":");
DateTime fileCreatedDate = File.GetCreationTime(filedate);
I am getting problem at the third line as given path's format is not supported.
Upvotes: 2
Views: 346
Reputation: 146
I think the way you wrote it is valid for local files. I would suggest going like :
https://msdn.microsoft.com/en-us/library/system.net.ftpwebresponse.lastmodified%28v=vs.110%29.aspx
And modify the code like this
string temp = response.StatusDescription;
temp = temp.Substring(temp.LastIndexOf(" ") + 1);
string FileCreationDateTime= temp.Substring(0, 4) + "-" + temp.Substring(4, 2) + "-" + temp.Substring(6, 2);
Upvotes: 0
Reputation: 1525
File.GetCreationTime only works with files. You are trying to get the date of a ftp resource. Try something like this:
Retrieving creation date of file (FTP)
Upvotes: 1