2

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.

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
Dinesh
  • 21
  • 1

2 Answers2

1

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)

Community
  • 1
  • 1
GreenEyedAndy
  • 1,485
  • 1
  • 14
  • 31
0

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);
Hristo Alexsiev
  • 146
  • 2
  • 11