Search code examples
cronrsyncfile-copying

Copy all files on cron run - regular task


I've got a virtual dedicated server (running FreeBSD 6.x) and I need to regulary backup files from one folder to another, say from /home/LOGIN/data/www/mydomain.com/test1 to /home/LOGIN/data/www/mydomain.com/test2. I've tried different approaches:

rsync -a /home/LOGIN/data/www/mydomain.com/test1 /home/LOGIN/data/www/mydomain.com/test2
cp /home/LOGIN/data/www/mydomain.com/test1 /home/LOGIN/data/www/mydomain.com/test2
cp www/mydomain.com/test1 /www/mydomain.com/test2

but all this didn't work, it gave error #127 and others.

AFAIK this can be done using a php script to run by cron also.

what is the better way?


Solution

  • try

    cp /home/LOGIN/data/www/mydomain.com/test1/* /home/LOGON/data/www/mydomain.com/test2

    and make sure the test2 directory is existent