Someone is FTPing a file of size 10Mb to folder on a linux server.
While the file is in transition a cron wakes up and fires off a Perl script that is designed to look at the ftp folder and move whatever it finds there to some alternate folder. I'm using the move()
function from File::Copy. The Perl process actually renames the files as part of its task. Does that matter, or does the FTP not care what the file system describes the file as?
Will move()
succeed and move a partial file, leaving the FTP to do what?
Or will move fail and return 0?
No, move should just let complete the download process on the new position . You are just moving the inode from one position to another. The open file descriptor from the download program should still point to it.
I just want to repeat what a few others mentioned. This only works as long as the move operation is on the same filesystem. If it as another filesystem than the inode cannot be transferred because it always belongs to the same filesystem. The most probably scenario then would be that the partial data at that moment is copied over to the new location while the program still downloads in the old inode which is not anymore attached to a file and therefor can not be used.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With