You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Ma...@donovandata.com on 2006/03/24 20:30:37 UTC

[Net]Getting timestamp of 2005 instead of 2006 in FTPFile

Hi,

I use the FTPClient of the commons net library.  I do listFiles and get 
the timestamp of the file iam interested in. The timestamp shows 2005. 
The file is uploaded to a linux box and it shows 2006  ( I used the approp 
option in ls ).

Here is the relevant code --

FTPFile[] files = listFiles();
                        for (int i = 0; i < files.length; i++) {
retCal = files[i].getTimestamp();



System.out.println("YEAR IN TSTAMP:"+tStamp.get(Calendar.YEAR));


Am I missing something

Thanks

Mahesh

Re: [Net]Getting timestamp of 2005 instead of 2006 in FTPFile

Posted by Ma...@donovandata.com.
Yes Iam sure Iam checking the timestamp of the file on the server. In fact 
the day,month , hour, min, secmatch. It is only the year showing up as 
2005 instead of 2006

Regards

Mahesh 



Derick Fernando <de...@thelabllc.com> 
03/24/2006 02:52 PM
Please respond to
"Jakarta Commons Users List" <co...@jakarta.apache.org>


To
Jakarta Commons Users List <co...@jakarta.apache.org>
cc

Subject
Re: [Net]Getting timestamp of 2005 instead of 2006 in FTPFile






My mistake, I misread your first post and thought you wanted to maintain 
the timestamp on the remote machine. Stating the obvious, but you are 
sure you are checking the timestamp from listFiles on the uploaded server?

Mahesh.Trikannad@donovandata.com wrote:
> Iam sorry I dont understand your response.
> 
> Can you tell me why Iam getting a 2005. 
> 
> I do a listFiles, which I assume gets the list  from a FTP to  the 
remote 
> machine (dir or ls). The remote machine has the file stored as 2006. Why 

> does it get a 2005.
> 
> 
> Thanks
> 
> Mahesh
> 
> 
> 
> Derick Fernando <de...@thelabllc.com> 
> 03/24/2006 02:40 PM
> Please respond to
> "Jakarta Commons Users List" <co...@jakarta.apache.org>
> 
> 
> To
> Jakarta Commons Users List <co...@jakarta.apache.org>
> cc
> 
> Subject
> Re: [Net]Getting timestamp of 2005 instead of 2006 in FTPFile
> 
> 
> 
> 
> 
> 
> Hello,
> 
> The FTP protocol does not support setting timestamps on remote machines, 

>   so the 2006 timestamp is created when the file is created on the 
> remote machine.
> 
> Mahesh.Trikannad@donovandata.com wrote:
> 
>>Hi,
>>
>>I use the FTPClient of the commons net library.  I do listFiles and get 
>>the timestamp of the file iam interested in. The timestamp shows 2005. 
>>The file is uploaded to a linux box and it shows 2006  ( I used the 
> 
> approp 
> 
>>option in ls ).
>>
>>Here is the relevant code --
>>
>>FTPFile[] files = listFiles();
>>                        for (int i = 0; i < files.length; i++) {
>>retCal = files[i].getTimestamp();
>>
>>
>>
>>System.out.println("YEAR IN TSTAMP:"+tStamp.get(Calendar.YEAR));
>>
>>
>>Am I missing something
>>
>>Thanks
>>
>>Mahesh
>>
>>__________ NOD32 1.1275 (20051103) Information __________
>>
>>This message was checked by NOD32 antivirus system.
>>http://www.eset.com
>>
>>
> 
> 
> 


-- 
.........................................

Derick Fernando
Lead Architect
derickf@thelabllc.com
(323) 314-9593
http://www.thelabllc.com

Content is for intended recipient only.
Copyright 2001-2005, The Lab, LLC

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org



Re: [Net]Getting timestamp of 2005 instead of 2006 in FTPFile

Posted by Derick Fernando <de...@thelabllc.com>.
My mistake, I misread your first post and thought you wanted to maintain 
the timestamp on the remote machine. Stating the obvious, but you are 
sure you are checking the timestamp from listFiles on the uploaded server?

Mahesh.Trikannad@donovandata.com wrote:
> Iam sorry I dont understand your response.
> 
> Can you tell me why Iam getting a 2005. 
> 
> I do a listFiles, which I assume gets the list  from a FTP to  the remote 
> machine (dir or ls). The remote machine has the file stored as 2006. Why 
> does it get a 2005.
> 
> 
> Thanks
> 
> Mahesh
> 
> 
> 
> Derick Fernando <de...@thelabllc.com> 
> 03/24/2006 02:40 PM
> Please respond to
> "Jakarta Commons Users List" <co...@jakarta.apache.org>
> 
> 
> To
> Jakarta Commons Users List <co...@jakarta.apache.org>
> cc
> 
> Subject
> Re: [Net]Getting timestamp of 2005 instead of 2006 in FTPFile
> 
> 
> 
> 
> 
> 
> Hello,
> 
> The FTP protocol does not support setting timestamps on remote machines, 
>   so the 2006 timestamp is created when the file is created on the 
> remote machine.
> 
> Mahesh.Trikannad@donovandata.com wrote:
> 
>>Hi,
>>
>>I use the FTPClient of the commons net library.  I do listFiles and get 
>>the timestamp of the file iam interested in. The timestamp shows 2005. 
>>The file is uploaded to a linux box and it shows 2006  ( I used the 
> 
> approp 
> 
>>option in ls ).
>>
>>Here is the relevant code --
>>
>>FTPFile[] files = listFiles();
>>                        for (int i = 0; i < files.length; i++) {
>>retCal = files[i].getTimestamp();
>>
>>
>>
>>System.out.println("YEAR IN TSTAMP:"+tStamp.get(Calendar.YEAR));
>>
>>
>>Am I missing something
>>
>>Thanks
>>
>>Mahesh
>>
>>__________ NOD32 1.1275 (20051103) Information __________
>>
>>This message was checked by NOD32 antivirus system.
>>http://www.eset.com
>>
>>
> 
> 
> 


-- 
.........................................

Derick Fernando
Lead Architect
derickf@thelabllc.com
(323) 314-9593
http://www.thelabllc.com

Content is for intended recipient only.
Copyright 2001-2005, The Lab, LLC

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [Net]Getting timestamp of 2005 instead of 2006 in FTPFile

Posted by Ma...@donovandata.com.
Iam sorry I dont understand your response.

Can you tell me why Iam getting a 2005. 

I do a listFiles, which I assume gets the list  from a FTP to  the remote 
machine (dir or ls). The remote machine has the file stored as 2006. Why 
does it get a 2005.


Thanks

Mahesh



Derick Fernando <de...@thelabllc.com> 
03/24/2006 02:40 PM
Please respond to
"Jakarta Commons Users List" <co...@jakarta.apache.org>


To
Jakarta Commons Users List <co...@jakarta.apache.org>
cc

Subject
Re: [Net]Getting timestamp of 2005 instead of 2006 in FTPFile






Hello,

The FTP protocol does not support setting timestamps on remote machines, 
  so the 2006 timestamp is created when the file is created on the 
remote machine.

Mahesh.Trikannad@donovandata.com wrote:
> Hi,
> 
> I use the FTPClient of the commons net library.  I do listFiles and get 
> the timestamp of the file iam interested in. The timestamp shows 2005. 
> The file is uploaded to a linux box and it shows 2006  ( I used the 
approp 
> option in ls ).
> 
> Here is the relevant code --
> 
> FTPFile[] files = listFiles();
>                         for (int i = 0; i < files.length; i++) {
> retCal = files[i].getTimestamp();
> 
> 
> 
> System.out.println("YEAR IN TSTAMP:"+tStamp.get(Calendar.YEAR));
> 
> 
> Am I missing something
> 
> Thanks
> 
> Mahesh
> 
> __________ NOD32 1.1275 (20051103) Information __________
> 
> This message was checked by NOD32 antivirus system.
> http://www.eset.com
> 
> 


-- 
.........................................

Derick Fernando
Lead Architect
derickf@thelabllc.com
(323) 314-9593
http://www.thelabllc.com

Content is for intended recipient only.
Copyright 2001-2005, The Lab, LLC

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org



Re: [Net]Getting timestamp of 2005 instead of 2006 in FTPFile

Posted by Ma...@donovandata.com.
Hi Derick,

Sorry, I think my question was NOT correctly sequenced , so it was 
misleading.


I connect to that box using FTPCLient,upload a file and  do a listFiles. I 
search FTPFile[] for the file I uploaded and print the timestamp.
Here is the code, I have added the upload operation too

// UPLOAD
FileInputStream in = new FileInputStream(localFile);
                        boolean result = storeFile(serverFile, in);
                        in.close();
// UPLOAD DONE

// LIST FILES AND PRINT TIMESTAMP OF THE ONE IAM INTERESTED IN
FTPFile[] files = listFiles();
>                         for (int i = 0; i < files.length; i++) {
>                          { 
 
                     retCal = files[i].getTimestamp();
> 
>                              System.out.println("YEAR IN 
TSTAMP:"+tStamp.get(Calendar.YEAR));
 
And the System.out shows me 2005. Everything else is correct on the 
timestamp.

Regards
Mahesh





Derick Fernando <de...@thelabllc.com> 
03/24/2006 02:40 PM
Please respond to
"Jakarta Commons Users List" <co...@jakarta.apache.org>


To
Jakarta Commons Users List <co...@jakarta.apache.org>
cc

Subject
Re: [Net]Getting timestamp of 2005 instead of 2006 in FTPFile






Hello,

The FTP protocol does not support setting timestamps on remote machines, 
  so the 2006 timestamp is created when the file is created on the 
remote machine.

Mahesh.Trikannad@donovandata.com wrote:
> Hi,
> 
> I use the FTPClient of the commons net library.  I do listFiles and get 
> the timestamp of the file iam interested in. The timestamp shows 2005. 
> The file is uploaded to a linux box and it shows 2006  ( I used the 
approp 
> option in ls ).
> 
> Here is the relevant code --
> 
> FTPFile[] files = listFiles();
>                         for (int i = 0; i < files.length; i++) {
> retCal = files[i].getTimestamp();
> 
> 
> 
> System.out.println("YEAR IN TSTAMP:"+tStamp.get(Calendar.YEAR));
> 
> 
> Am I missing something
> 
> Thanks
> 
> Mahesh
> 
> __________ NOD32 1.1275 (20051103) Information __________
> 
> This message was checked by NOD32 antivirus system.
> http://www.eset.com
> 
> 


-- 
.........................................

Derick Fernando
Lead Architect
derickf@thelabllc.com
(323) 314-9593
http://www.thelabllc.com

Content is for intended recipient only.
Copyright 2001-2005, The Lab, LLC

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org



Re: [Net]Getting timestamp of 2005 instead of 2006 in FTPFile

Posted by Derick Fernando <de...@thelabllc.com>.
Hello,

The FTP protocol does not support setting timestamps on remote machines, 
  so the 2006 timestamp is created when the file is created on the 
remote machine.

Mahesh.Trikannad@donovandata.com wrote:
> Hi,
> 
> I use the FTPClient of the commons net library.  I do listFiles and get 
> the timestamp of the file iam interested in. The timestamp shows 2005. 
> The file is uploaded to a linux box and it shows 2006  ( I used the approp 
> option in ls ).
> 
> Here is the relevant code --
> 
> FTPFile[] files = listFiles();
>                         for (int i = 0; i < files.length; i++) {
> retCal = files[i].getTimestamp();
> 
> 
> 
> System.out.println("YEAR IN TSTAMP:"+tStamp.get(Calendar.YEAR));
> 
> 
> Am I missing something
> 
> Thanks
> 
> Mahesh
> 
> __________ NOD32 1.1275 (20051103) Information __________
> 
> This message was checked by NOD32 antivirus system.
> http://www.eset.com
> 
> 


-- 
.........................................

Derick Fernando
Lead Architect
derickf@thelabllc.com
(323) 314-9593
http://www.thelabllc.com

Content is for intended recipient only.
Copyright 2001-2005, The Lab, LLC

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org