Files copying between servers by creation time

Posted by driftux on Server Fault See other posts from Server Fault or by driftux
Published on 2012-09-18T14:08:43Z Indexed on 2012/09/18 15:41 UTC
Read the original article Hit count: 191

My bash scripting knowledge is very weak that's why I'm asking help here. What is the most effective bash script according to performance to find and copy files from one LINUX server to another using specifications described below.

I need to get a bash script which finds only new files created in server A in directories with name "Z" between interval from 0 to 10 minutes ago. Then transfer them to server B. I think it can be done by formatting a query and executing it for each founded new file "scp /X/Y.../Z/file root@hostname:/X/Y.../Z/" If script finds no such remote path on server B it will continue copying second file which directory exists. File should be copied with permissions, group, owner and creation time.

X/Y... are various directories path. I want setup a cron job to execute this script every 10 minutes. So the performance is very important in this case.

Thank you.

© Server Fault or respective owner

Related posts about linux

Related posts about bash