Link to home
Start Free TrialLog in
Avatar of sherbug1015
sherbug1015Flag for United States of America

asked on

How FTP pulls files

I am pulling files from a customer's ftp sever on a daily basis.  Up until recently, we had no problems but suddenly we are getting files with today's date and the file has some other day's data.  It turns out that we rename the file on our side and the customer is trying to say we are messing up the data when we rename it.

Can someone please explain how ftp works when there are multiple files with virtually the same file name with a different date.

For example if the customer had three files on the ftp server
M700111.1234   10/31/2013
M700111.4567    11/01/2013
M700111.8999     11/02/2013

Given the following script what would be pulled from the customer's ftp server.    

1.  open 999.999.999.999
2.  user MICKEYMOUSE
3.  PASSWORD
4.  prompt
5.  lcd c:\TEMP\
6.  bin
7.  mget *.*
8.  quit
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

That should get all of the files in the current remote directory.
Avatar of Bill Prew
Bill Prew

It sounds like you are assuming that there will only be one file named M700111.<anything> ?  If that's the case, then you are likely to run into problems given that there can now be multiple files with that same base name, but different extensions.

I suspect that you are renaming the file based on the system clock on the receiving computer, and so multiple files could get the same time stamp when they are pulled, which may be a problem.

I guess the root question is what do you want to happen when there are more than one of these files?  Pull the latest one? Pull all and rename with the modified date from the remote system?  Etc...

~bp
Avatar of sherbug1015

ASKER

billprew -  that is what I would have thought as well.  I just went back to the customers ftp site and they had dropped another file out there since this morning when I first picked up.

There is a file called

BCL.SDOA.1442238  -  11/04/13  2:20 p.m.
BCL.SDOA.1442078  -  11/03/13  2:20 p.m.

I picked up the 11/03 file this morning and when I ran my script, it only picked up the 11/4 file.  Same file name, different extension.

How does it know that the 11/03 file has already been picked up is my question.  Is there something I am missing here.  It must be using some kind of system time to determine what has been picked up.  Can you confirm anything like that.

thanks
If you have not renamed the file, then you probably won't see the 'over-write warning' dialog in a script like you would in a desktop client.  For a test, rename both files on your computer and run your script again.  I suspect it will then re-download both of them.
SOLUTION
Avatar of Bill Prew
Bill Prew

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial