Get accurate modified & created times

Oct 30, 2014 at 1:34 PM
Hi,

I am writing a autocleaner and implemented FtpClient. Now I am running into problems when I am trying to compare Modified or Created DateTimes. It looks like FtpClient does not get any correct times from the FTP Server (FileZilla Server), but instead the default DateTime: 01-Jan-01 12:00:00 AM.

How can I get the accurate DateTimes? Here is some Source Code:
// Setup Client
            FtpClient client = new FtpClient();
            FTP.setupClient(servername, port, username, password, encryption, ref client);

            // Get all content
            List<FtpListItem> listFTPItems = client.GetListing(path, FtpListOption.Recursive | FtpListOption.ForceList).ToList();
            List<String> filePathsToDelete = new List<string>();

            if (timeAttribute == HM.timeAttributes.creationDate)
            {
                foreach (var item in listFTPItems)
                {
                    Console.WriteLine("DEBUG:");
                    Console.WriteLine((DateTime.Now - item.Created.ToLocalTime()).Days);
                    if (item.Type == FtpFileSystemObjectType.File && (DateTime.Now - item.Created).Days > deleteOlderThanXDays)
                    {
                        filePathsToDelete.Add(item.FullName);
                    }
                }
            }
            else if (timeAttribute == HM.timeAttributes.lastWriteDate)
            {
                foreach (var item in listFTPItems)
                {
                    if (item.Type == FtpFileSystemObjectType.File && (DateTime.Now - item.Modified).Days > deleteOlderThanXDays)
                    {
                        filePathsToDelete.Add(item.FullName);
                    }
                }
            }

            // Dateien löschen
            foreach (var item in filePathsToDelete)
            {
                client.DeleteFile(item);
            }