Already i am trying to achieve this by below script
# Go to the directory from where want to copy files
cd /mydir
find . -type f -mtime 1 -exec cp {} /destdir\;
find . -type f -mtime 1 -exec cp {} /destdir1\;
And then installing this script in crontab as @daily so it can be run everyday 12 am.
The find -mtime 1 primary looks for files that are exactly 24 hours old. If you run two invocations of find a second apart, they will not copy the same file (if either of them finds any file at all).
If your script runs close to midnight every night and your daily file comes in around 6am every morning, you can get by with:
cd /mydir
find . -type f -mtime -1 -exec cp {} /destdir\;
find . -type f -mtime -1 -exec cp {} /destdir1\;
to copy files that are less than 24 hours old.
If you might get a file close to midnight (just before, while, or just after your script is run) or your cron job might not run every day (and you still want to copy each file exactly once), you could try something like:
cd /mydir
touch /destdir/.now
find . -type f -newer /destdir/.previous -exec cp {} /destdir \;
find . -type f -newer /destdir/.previous -exec cp {} /destdir1 \;
mv /destdir/.now /destdir/.previous
You'll need to create /destdir/.previous with an appropriate timestamp before you run this script the first time, but after that it should do what you want. There is, however, a chance that a file will be copied twice (once today and once again tomorrow) if a file is created in /mydir while your script is running.