Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Incomplete FTP Files 1

Status
Not open for further replies.

tbohon

Programmer
Apr 20, 2000
293
US
I have a situation where my ftp script is grabbing a large file before it's completely generated on the source system. Normally I'd have the source system write a flag file which, if present, indicates that the file I really want has been completed. However, management wants the process expanded to some 35+ databases/servers ... and getting everything modified to write flag files (and to maintain that logic through updates, etc.) would be a nightmare.

Does anyone have any suggestions? Someone told me to turn on the 'incomplete file' flag ... but can't find any reference to that nor have I ever heard of it before.

Thanks in advance for your assistance.

Best,

Tom

"My mind is like a steel whatchamacallit ...
 

Rename file after transfer:
Code:
OPEN ...
PUT MyFile.txt MyFile.tmp
RENAME MyFile.tmp MyFile.txt
BYE
[3eyes]


----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Thanks for the input. Guess I don't fully understand how this will solve the problem of grabbing a file before it's been fully generated ... ???

Tom

"My mind is like a steel whatchamacallit ...
 

Well, the trick is that the process at the target server will be looking for a file with a specific name, therefore it will not find it until the transfer is complete and the file renamed to the correct name. [thumbsup]

----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Hmmmmmm ... interesting. And this will work when I'm going out to do a get on the file as well?

Tom

"My mind is like a steel whatchamacallit ...
 
tbohon,
why doncha try and see it.

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
And this will work when I'm going out to do a get on the file as well?

Only if the source does the same thing, naming the file with expected name when process is complete. [thumbsup2]



----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 

On doing a get if you are SURE the source file is 'complete' you can 'GET' the file to temporary name and then after the ftp, rename it:
Code:
$ FTP <<EOF
OPEN ...
GET MyFile.txt MyFile.tmp
BYE
EOF
$ mv MyFile.tmp MyFile.txt
[medal]

----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top