Ftp and batch file question
im gonna be writing a script that will seach a folder for a certain file extension and FTP these particular files to an AS/400 server automatically (ie an in house service will be running that runs this script every few minutes). these files are being created by another small console app. i only want to send the files when they are complete, and since this process of createing them is pretty damn quick i dont think there will be a problem... but there is always the chance that the ftp script will try to send the file at a moment when the file will be open and being created. so if anyone can answer this, will the ftp fail if a file is open and being written too at that moment that it tries to send it(which would be great, because then the script could pick it up on the next pass) or will it send a partial file (which is not great)?
no, it will not fail.
You should try copying it to another directory and then mv'ing it. you're guaranteed to be sorted via mv, since all it does it reroute an inode, and therefore doesn't actually move the file at all.
Failure is a function of the operating system. LinuxPenguin is correct in that it won't fail on a linux/unix OS. On a Windows OS, then it depends upon the flags given then the file is create/opened by the creating process.
I agree about the moving of the file. This will work for for both OSs.
just to follow up, yea i went with moving the file first to a temp FTP directory and from there a little mfc app will push the files to the server. thanks for the info.