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?

Not sure I understand what your question is. Why doesn't it work with the xml file?

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.

Sorry, I'm lost, I don't think I can help you.

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

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?

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?

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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.