1831185 Members
2778 Online
110021 Solutions
New Discussion

Date check of file on NT

 
Jim Mulligan_1
New Member

Date check of file on NT

Can someone please tell me how I might do the following?
I need to check the date that a file was created on a NT server and compare it to currant date then ftp it to a UNIX server if it is currant.

Thanks,
Jim
7 REPLIES 7
James R. Ferguson
Acclaimed Contributor

Re: Date check of file on NT

Jim:

Look at the man pages for 'ftp'. Instead of doing a "get", use "newer". This 'get' the file only if the modification time of the remote file is more recent that the file on the current system. If the file does not exist on the current system, then the remote file is considered newer.

...JRF...
Jim Mulligan_1
New Member

Re: Date check of file on NT

James,

The ?newer? option in ftp works fine when getting the file for the first time from the NT server however on the second try with a newer file (testfile.txt) in place I get an error message.
500 ?MDTM testfile.txt? : command not understood
Any other suggestions will be appreciated.

Jim
Tim Malnati
Honored Contributor

Re: Date check of file on NT

The easiest way to handle this is to mount the NT file system on the unix box using samba client or NFS and then use standard unix commands/scripts or whatever to copy stuff around.

Another alternative is use one of the ftp based public domain mirroring software packages (mirror, rsync, etc) to do it, but it requires that you setup the NT box as a FTP server which can be somewhat shakey situation from a security point of view.
James R. Ferguson
Acclaimed Contributor

Re: Date check of file on NT

Hi Jim:

Well so much for NT ;-)

This works fine in UNIX but I regret that I can't make it work from NT either. I get the same error as you do.

...JRF...
Jim Mulligan_1
New Member

Re: Date check of file on NT

James,
Thanks for trying.

Tim,
I'll make the suggestion but since I'm a contractor I can't just do it.

Thanks,
Jim
James H. Trice Ph.D.
Occasional Advisor

Re: Date check of file on NT

I had this same problem. The only way I could find to handle it was to issue a directory command, parse out the date and time and compare that to the reference date and time (using perl). One other problem I had was that the date and time on a directory did not change on NT when the contents of the directory were modified. I have not figured out what to do about that.
Jim Trice
Jim Mulligan_1
New Member

Re: Date check of file on NT

Dr. James,
Thank you for your comments but what we have decided to do is after doing a get from the NT server we are going to rename the file. So if the file is there tomorrow we do a get and rename again and so on. We thing this will server our purpose.

Thanks again,
Jim