![]() |
| | #16 |
| pwning noobs Join Date: Jun 2009 Location: The Great White North
Posts: 125
| |
| Zlatko is offline | |
| | #17 | |
| subminimalist Join Date: Jul 2008 Location: NYC
Posts: 3,946
| Quote:
Of course, that sounds like exactly what you are trying to do. I'm going to guess you are just running ftp with a list of files. If so, take a few steps back to consider the nature of the problem. You should be calling ftp within your C program (or shell script); this way you can wait for it to complete a file, then transfer it.
__________________ Accuracy and integrity mean nothing if you don't make it past the censors...PYTHAGORAS | |
| MK27 is online now | |
| | #18 | |
| Registered User Join Date: Oct 2008 Location: TX
Posts: 1,262
| Quote:
| |
| itCbitC is offline | |
| | #19 | |
| Senior software engineer Join Date: Mar 2007 Location: Portland, OR
Posts: 5,381
| Quote:
Is it an FTP client or an FTP server which is depositing the files? If a client, then you can script the activity to move the complete file to the target directory after the download is complete. If it's a server, then your server is braindead. It's an extremely common task to monitor an FTP upload area for new files. Any FTP server that isn't completely stupid has a way of downloading files to a temporary area then MOVING them to their final location when the download is complete. Exactly because of this issue. Even better servers give you the ability to run a trigger when a file has been completely uploaded.
__________________ "Congratulations on your purchase. To begin using your quantum computer, set the power switch to both off and on simultaneously." -- raftpeople@slashdot | |
| brewbuck is offline | |
| | #20 |
| Registered User Join Date: Jan 2007
Posts: 40
| brewbuck: I'm not sure what you mean. I have an FTP server which is set to *receive* files. Various people will ftp in and upload a file to the server. It is then the server's responsibility to forward these files (when they are complete) to another computer (which is what my program will do, and that code is no problem). The problem is, I don't know when the files are done being uploaded from the various clients except presumably when the files are closed and ftp is no longer accessing them. I have no control over what the client does to ftp in the file, so they're most likely to just upload the file directly, rather than uploading it to a temp location and then moving it. If there's anything the FTP server can do to assist, I'm not sure how to utilize it. As it stands, I look in the directory where the files are coming in, and I see the files created at 0 bytes, and then watch them increase in size as the data transmits through ftp, until the transfer completes. As far as I'm aware, no file movement is happening. |
| IsmAvatar2 is offline | |
| | #21 |
| subminimalist Join Date: Jul 2008 Location: NYC
Posts: 3,946
| There has got to be a way there, even if you don't know about it. There is no such thing as software that dysfunctional. You're talking about a very simple and commonplace task. Why don't you say specifically which ftp server you are using?
__________________ Accuracy and integrity mean nothing if you don't make it past the censors...PYTHAGORAS |
| MK27 is online now | |
| | #22 | |
| Registered User Join Date: Oct 2008 Location: TX
Posts: 1,262
| Quote:
Use a shell to script this process and run fuser on the file periodically to see if ftp is done transferring it. Incidentally fuser is a simple maintenance command instead of a syscall or a stdlib. Code: man fuser | |
| itCbitC is offline | |
| | #23 |
| Registered User Join Date: Jan 2007
Posts: 40
| vsftpd and Debian. |
| IsmAvatar2 is offline | |
![]() |
| Tags |
| file, fuser, lock, lsof, open |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| C Delete opened file | gidion | C Programming | 25 | 12-04-2008 10:35 AM |
| Formatting a text file... | dagorsul | C Programming | 12 | 05-02-2008 03:53 AM |
| Need Help Fixing My C Program. Deals with File I/O | Matus | C Programming | 7 | 04-29-2008 07:51 PM |
| spell check in C using a dictionary file | goron350 | C Programming | 10 | 11-25-2004 06:44 PM |
| C programming with Unix functions for manipulation of a virtual file system | zagelle | C Programming | 4 | 10-21-2003 04:28 PM |