I am trying to create a shell script (.ksh) that will be run on AIX 5300-10 to scp files from one server to another.
The only files I am interested in are the ones that were created in the last 24 hours of whenever the script was run. There are numerous other files in the source directory that were created some time ago, and I do not want to copy these.
Does anybody have ideas on how this can be achieved? I know there is the find command that I can use, but I do not know if this caters for what I require.
find . -mtime 0 # find files modified between now and 1 day ago
# (i.e., within the past 24 hours)
find . -mtime -1 # find files modified less than 1 day ago
# (i.e., within the past 24 hours, as before)
find . -mtime 1 # find files modified between 24 and 48 hours ago
find . -mtime +1 # find files modified more than 48 hours ago
find . -ctime -1 # which are created in less then 1 day from currrent folder.
find . -ctime +2 # finds files which are created older then 2 days from currrent folder