Question: identify files still being uploaded



In my sftp server, I have a script to check the server every 5 minutes and then process the new files (files can be uploaded to the server at any time). sometime the files are still uploading when the script is triggered, how do I skip the script when the file uploading is still ongoing. thanks.
.