Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
9.2k views
in Java FTP by
Hi,

I have a file listed with today date
-rwx---r-x 1 system System 10690 Oct 18 21:31 20041018163140.bin

When I call lastModified() method in the FTPFile it returns
10/18/2003 instead of 10/18/2004.

FTPFile[] remotefiles = ftpclient.dirDetails(".");
for(int i=0; i < remotefiles.length; i++)
{
FTPFile remotefile = remotefiles[i];
String filename = remotefile.getName();
Date date = remotefile.lastModified();
}

Output:
Processing file: [20041018163140.bin][10/18/2003 21:31:00]

13 Answers

0 votes
by (161k points)
Are you and the FTP server in the same time zone?

This can only happen if the below is true:

if (lastModified.after(cal.getTime()))

i.e. your machine's current time is before the last modified timestamp of the file, using the current year.


Hi,

I have a file listed with today date
-rwx---r-x 1 system System 10690 Oct 18 21:31 20041018163140.bin

When I call lastModified() method in the FTPFile it returns
10/18/2003 instead of 10/18/2004.
0 votes
by (161k points)
Are the files just created on the FTP server?

Please check that the system times on the two machines are identical if you are in the same time zone - edtFTPj will not use the current year for the file timestamp if it appears to be in the future - it will assume it is the previous year.

Are you and the FTP server in the same time zone?

This can only happen if the below is true:

if (lastModified.after(cal.getTime()))

i.e. your machine's current time is before the last modified timestamp of the file, using the current year.

0 votes
by
I am using the latest version of edtftp.jar file. The lastmodified() always returns 2005 for 2006 files but displays the correct year for 2005 files. Everything is on linux both the server where i am ftping to and the actual FTP server.

I saw the problem and was wondering if it has been fixed.

Thanks in advance for the help.
0 votes
by (161k points)
If you log into the FTP server on the command line, type 'dir' to get a listing that you can copy here. We can then test it out.

I am using the latest version of edtftp.jar file. The lastmodified() always returns 2005 for 2006 files but displays the correct year for 2005 files. Everything is on linux both the server where i am ftping to and the actual FTP server.

I saw the problem and was wondering if it has been fixed.

Thanks in advance for the help.
0 votes
by
There are files with 2005 and 2006 timestamps. 2005 work fine. 2006 show year as 2005 for lastmodified().

229 Entering Extended Passive Mode (|||55121|)
150 Here comes the directory listing.
-rw-rw-r-- 1 100 101 385204 Oct 07 18:33 093005.txt_1128544288510 _1128709998779
-rw-rw-r-- 1 100 101 57 Jan 12 18:47 123456789-1.txt_11370916 57968
-rw-rw-r-- 1 100 101 342 Jan 12 18:47 5750054.txt_113709164537 0
-rw-rw-r-- 1 100 101 44 Oct 07 18:36 prodFt.txt_1128710180506
-rw-rw-r-- 1 100 101 44 Oct 07 19:40 prodFt.txt_1128714059497
-rw-rw-r-- 1 100 101 44 Oct 07 19:41 prodFt.txt_1128714104642
-rw-rw-r-- 1 100 101 44 Oct 07 19:43 prodFt.txt_1128714222768
-rw-rw-r-- 1 100 101 44 Oct 07 20:32 prodFt.txt_1128717133253
-rw-rw-r-- 1 100 101 44 Oct 11 20:25 prodFt.txt_1129062309896
-rw-rw-r-- 1 100 101 44 Oct 11 20:25 prodFt.txt_1129062356484
-rw-rw-r-- 1 100 101 44 Oct 11 20:44 prodFt.txt_1129063493450
-rw-rw-r-- 1 100 101 44 Oct 11 20:54 prodFt.txt_1129064044321
-rw-rw-r-- 1 100 101 342 Jan 12 18:50 reconprodFTtest.txt_1137 091838732
-rw-rw-r-- 1 100 101 342 Jan 12 19:22 reconprodFTtest.txt_1137 093757003
-rw-rw-r-- 1 100 101 342 Jan 12 19:23 reconprodFTtest.txt_1137 093832914
-rw-rw-r-- 1 100 101 342 Jan 12 19:26 reconprodFTtest.txt_1137 094014330
-rw-rw-r-- 1 100 101 342 Jan 12 19:31 reconprodFTtest.txt_1137 094264422
-rwxrwxrwx 1 100 101 66 Jan 12 21:14 test
drwxrwxr-x 2 100 101 48 Mar 17 2005 zipin
drwx------ 2 1002 101 48 Jul 27 17:49 zipout_image
226 Directory send OK.


Thanks
0 votes
by
Files with today's date are 2006 and the rest are 2005.
0 votes
by (161k points)
Are you sure you are using the latest version?

Our test against your listing gives 2006 for the Jan 12 files and 2005 for the rest.

Files with today's date are 2006 and the rest are 2005.
0 votes
by
I am using the version dated sep. 20th 2005 version 1.5.2
0 votes
by
lastModified() gives the wrong year for only the files that have timestamp of today's date. If it's yesterday it gives the correct year but only files that were uploaded today it is displaying year as 2005 and tomorrow for the same files it will show 2006.

Any help is appreciated.
0 votes
by (161k points)
Presumably this is because the timestamp of the file when retrieved from the server is in the future.

Is the timestamp a few seconds or minutes or hours ahead of the current time at the client?

lastModified() gives the wrong year for only the files that have timestamp of today's date. If it's yesterday it gives the correct year but only files that were uploaded today it is displaying year as 2005 and tomorrow for the same files it will show 2006.

Any help is appreciated.

Categories

...