Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
10k views
in General by (200 points)
We're connecting to a number of set-top boxes. The clocks on the boxes are not used, and as such, bear no resemblance to reality.

Because of this, the boxes occasionally decide it's leap day. When we call DirDetails, we get the "String was not recognized as a valid DateTime." error because all that is returned is:

-rw-r--r-- 1 root root 4833 Feb 29 12:10 filename.txt

The box thinks it is 2004, which makes Feb 29 be legit, but we know it's 2009, so we get the error.

Setting the clocks on the box is not an option. We don't need to get the date, just a list of the files on the box and the size of the file.

Is there a way to get around this issue?

Thanks!

6 Answers

0 votes
by (46.8k points)
Wow, that's a strange problem! In FTP (and in all our libraries) you can get a list of file-names without getting all the details. In .NET you can do this using FTPConnection.GetFiles() or FTPClient.Dir(). In Java you can do it using FileTransferClient.directoryNameList() or FTPClient.dir().

- Hans (EnterpriseDT)
0 votes
by (200 points)
We do still need to get the file sizes to determine if the file needs to be updated-- is there any way to avoid getting the list of files, then going file by file to get the file sizes?

Since this error causes the entire command to fail, it might be good to return a bogus date like 01/01/0001, rather than failing entirely. At least then we'd have some data back...
0 votes
by (46.8k points)
Which product are you using?

- Hans (EnterpriseDT)
0 votes
by (200 points)
edtFTPnet/PRO
0 votes
by (46.8k points)
OK, here are three options:
  1. Call GetSize() on each file
  2. Call GetFiles("mydir", true), which returns all the file information as strings (one for each file), and then parse it yourself.
  3. Write your own directory parser and set it using FileInfoParser.FileParser

- Hans (EnterpriseDT)
0 votes
by (46.8k points)
By the way, if you're using the GUI controls then you'll need to write an FTPFileParser.

- Hans (EnterpriseDT)

Categories

...