Perl FTP Problem

Please support our Perl advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Mar 2007
Posts: 11
Reputation: crazylunatic is an unknown quantity at this point 
Solved Threads: 0
crazylunatic crazylunatic is offline Offline
Newbie Poster

Perl FTP Problem

 
0
  #1
Feb 28th, 2008
I have this script which uses the Net::FTP module to copy some files to some remote machine.It works fine with every file but a xml file.My application requires that the timestamp of the xml file doesn't change but the ftp script changes it.Is there any way around it?
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 898
Reputation: KevinADC has a spectacular aura about KevinADC has a spectacular aura about 
Solved Threads: 67
KevinADC's Avatar
KevinADC KevinADC is offline Offline
Practically a Posting Shark

Re: Perl FTP Problem

 
0
  #2
Feb 28th, 2008
Not sure I understand what your question is. Why doesn't it work with the xml file?
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 11
Reputation: crazylunatic is an unknown quantity at this point 
Solved Threads: 0
crazylunatic crazylunatic is offline Offline
Newbie Poster

Re: Perl FTP Problem

 
0
  #3
Feb 29th, 2008
What I meant actually was that even if the timestamp of other files change ,it won't affect my application in any way.But the timestamp of the XML file should remain same.I tried copying a file to the remote host through Net::FTP and I did the same manually too.I tried to compare the two files through File::Compare and I got the result that both files weren't same.
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 898
Reputation: KevinADC has a spectacular aura about KevinADC has a spectacular aura about 
Solved Threads: 67
KevinADC's Avatar
KevinADC KevinADC is offline Offline
Practically a Posting Shark

Re: Perl FTP Problem

 
0
  #4
Feb 29th, 2008
Sorry, I'm lost, I don't think I can help you.
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 8
Reputation: tuxboy is an unknown quantity at this point 
Solved Threads: 1
tuxboy tuxboy is offline Offline
Newbie Poster

Re: Perl FTP Problem

 
0
  #5
Mar 3rd, 2008
Think that's just the way UNIX / Linux works. It will change the timestamp. Luckily, there is a command you could use to change it to the timestamp you need. Look into using the touch command.

Cheers
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 11
Reputation: crazylunatic is an unknown quantity at this point 
Solved Threads: 0
crazylunatic crazylunatic is offline Offline
Newbie Poster

Re: Perl FTP Problem

 
0
  #6
Mar 4th, 2008
Originally Posted by tuxboy View Post
Think that's just the way UNIX / Linux works. It will change the timestamp. Luckily, there is a command you could use to change it to the timestamp you need. Look into using the touch command.

Cheers
But the problem here is that I am using a windows 2003 server.So can you come up with any command which will revert back to the old timestamp?
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 8
Reputation: tuxboy is an unknown quantity at this point 
Solved Threads: 1
tuxboy tuxboy is offline Offline
Newbie Poster

Re: Perl FTP Problem

 
0
  #7
Mar 4th, 2008
Unfortunately, ftp is not the problem. That's the way the file system operates. It takes makes the timestamps reflective of the time the file is put there. You won't be able to address it without doing some coding on the target node or modifying your application.

If you look at the other files you are sending you'll see that the timestamps are actually changing on those too, so the issue is not just ftp doing something weird or unexpected with just xml files.

Curious as to what you application is doing triggering of a timestamp. Do you have privs on the system where you are sending files?
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 11
Reputation: crazylunatic is an unknown quantity at this point 
Solved Threads: 0
crazylunatic crazylunatic is offline Offline
Newbie Poster

Re: Perl FTP Problem

 
0
  #8
Mar 5th, 2008
Originally Posted by tuxboy View Post
Unfortunately, ftp is not the problem. That's the way the file system operates. It takes makes the timestamps reflective of the time the file is put there. You won't be able to address it without doing some coding on the target node or modifying your application.

If you look at the other files you are sending you'll see that the timestamps are actually changing on those too, so the issue is not just ftp doing something weird or unexpected with just xml files.

Curious as to what you application is doing triggering of a timestamp. Do you have privs on the system where you are sending files?
The xml file has some data related to some point-in-time copy of a disk.So if the time (read timestamp) itself changes then how can the application work.And yeah I have all the privileges on the system where I am sending the file.If it was a UNIX system then probably I would have addressed the issues but the fact that I am using a WIN2K3 server is crippling me.
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 8
Reputation: tuxboy is an unknown quantity at this point 
Solved Threads: 1
tuxboy tuxboy is offline Offline
Newbie Poster

Re: Perl FTP Problem

 
0
  #9
Mar 5th, 2008
Well, some ftp utilities allow using a 'preserve' option with MDTM, but my versions don't have it. So, check yours. If you don't find that workable, then, another option is to tar up the files, and extract them on the remote system. That should preserve the timestamps.

Honestly, though, in my work, I usually name files with a timestamp appended to the name of the file, rather than depend on the file system to give me that information accurately. Since, I move files from Linux, HPUX, OpenVMS, Windows, it is the only way I can deal with this type of issue. My applications that use these types of files parse the files based on the file names, not the timestamps.

Hope the above gives you some relief.

Cheers
Last edited by tuxboy; Mar 5th, 2008 at 2:38 pm. Reason: left out something
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 1,669
Reputation: jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of 
Solved Threads: 123
jephthah's Avatar
jephthah jephthah is offline Offline
Posting Virtuoso

Re: Perl FTP Problem

 
0
  #10
Mar 11th, 2008
use the perl command

utime( )

to change the timestamp of the file to be whatever you want.

http://www.perl.com/doc/manual/html/...unc/utime.html
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 2204 | Replies: 9
Thread Tools Search this Thread



Tag cloud for Perl
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC