I am trying to get all the files in SFTP directories that were last modified before 24 hours using Unix bash script. Please note that lftp option is not supported in my environment. So, I have created a script that will list all the sub directories of the SFTP directory to a local file, then I have used a loop to traverse all those sub directories names, printed the content of the directory using ls -ltr and directed that output to a local file.
Now I have a file with below content and let's assume that the current time is Oct 28th 22:32.
-rw------- 1 200 100 1930 Oct 25 08:31 File1
-rw------- 1 200 100 280 Oct 25 11:32 File2
-rw------- 1 200 100 280 Oct 25 12:17 File3
-rw------- 1 200 100 280 Oct 25 22:31 File4
-rw------- 1 200 100 280 Oct 26 22:32 File5
-rw------- 1 200 100 280 Oct 27 22:31 File6
-rw------- 1 200 100 280 Oct 16 09:59 File7
-rw------- 1 200 100 280 Oct 16 09:59 File8
-rw------- 1 200 100 280 Oct 16 10:00 File9
Is it possible to get all the filenames and their last modified time stamps with last modified date < sysdate - 24 hours?