In my environment, we'll be receiving files from clients into our Sftp server. Sftp processes the files, and moves it to another tool, by appending the file size at the end of the file name. For example, samplefile.20150706
of size 1024 would be created as samplefile.20150706.1024
.
If file size and name (the last part after .
) matches, our tool will pick the file and send it to ETL. If the file stays in that place for more than an hour (not processed due to unmatched size and name), the tool will send us alerts, as files are over an one hour old.
I'm looking for commands, which will extract the last part of the file name and compare it with file size, and eventually delete the file.