I am bit puzzled with this requirement where I need to list the files in a directory. However, files are being continuously written to this folder through FTP. Hence I need to exclude the file which is being written at the time of listing the directory. I thought of using file time stamp. I can list files with timestamps 5 minutes before the time I run ls -lrt command. I believe time taken to ftp the file will not take more than 5 minutes based on my observation.
I am not sure how do I list file based on time. Any help on this is highly appreciated. If there is any other option, please let me know.
touch my-ref-file
sleep 5
find dir ! -newer my-ref-file
The sleep is just to ensure that at least some further file growth from an incoming FTP will occur. Slower than that, then I would expect the FTP to timeout anyway.
I hope that this helps,
Robin
Liverpool/Blackburn
UK