I've a directory having constantly changing filenames (by numerical value) listed as:
-rw-rw----. 1 root root 10493952 May 7 10:39 A0000000.LOG -rw-rw----. 1 root root 10493952 May 7 08:38 A0000001.LOG -rw-rw----. 1 root root 10493952 May 7 08:38 A0000002.LOG ... ... -rw-rw----. 1 root root 10493952 May 7 08:38 A0000582.LOG ... and so on...
Now, at any given moment, my app throws a filename from these listed files. I've to discard that file and any other file having greater numerical value than that file from rsyncing to remotehost
Say application throws file
And I if I see
A0000097.LOG getting created as well, I would::
rsync A* --exclude A0000096.LOG --exclude A0000097.LOG user@remoteHost:/somedir/
Points to note:
App throws different file name to rsync cron job running every hour. In this example, filename is
Files having higher numerical value than App's output filename (
A0000096.LOGin above example) can have same create date/timestamp as App's output filename
By the time rsync starts, App's output filename can have more recent altered date/timestamp than files having higher numerical value.
There may be a possibility that higher numerical value files not getting created or may get created more than just 1 (could be 10 to 20)
Question: With these restrictions, I'm not able to find how can I provide all higher numerical value files to my rsync bash script so that I can exclude them.
Any help is appreciated.
rsync --deletenot work?