Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LINUX: how to detect that ftp file upload is finished

Tags:

linux

upload

ftp

In my project I have a file uploading feature. Files are uploaded via FTP. I need to configure a listener that will check for new files and invoke a script only when file uploading is finished. Because if I run this script immediately after detecting the new file, it can start to process file that is not completely uploaded, which will cause an error. Can anybody tell if this is possible on LINUX and how can I do this?

like image 973
andr111 Avatar asked Jun 18 '10 14:06

andr111


People also ask

How can I tell if a file is completed on a FTP server?

A possible solution would be first uploading the file with a different filename (e.g. adding ". partial") and then renaming it to its final name. If the server finds the final name then the upload has been completed.

Where does FTP download files to Linux?

Downloading Files with the ftp Command Once you are logged in, your current working directory is the remote user home directory. When downloading files with the ftp command, the files will be downloaded to the directory from which you typed the ftp command.

Does FTP move or read files?

All about File Transfer Protocol and FTP clients File Transfer Protocol (FTP) is a network protocol for transferring copies of files from one computer to another. An FTP client is a program that allows you to move files between computers.


1 Answers

I'd try using inotify, event code IN_CLOSE_WRITE.

like image 100
Joril Avatar answered Oct 05 '22 14:10

Joril