If you have two Dreamhost ftp account with SSH permission, and you want to transfer the content from account A to Account B, you need following script to do it.
It is simply one line shell command. I save it into a sh file. Schedule to run it every two hours.
Here is the script for you.
Name of Account A: ftp2010
Host name for ftp2010: hosting.mydomain.com
Name of Account B: ftp2011
Host name of ftp2011: hosting.yourdomain.com
The target is to transfer all files under ftp2010 to ftp2011 at hosting.yourdomain.com

1) SSH to hosting.mydomain.com with ftp2010 account
2) Run following command

rsync -e  ssh -av /home/ftp2010/ ftp2011@hosting.yourdomain.com:/home/ftp2011/

It will promote you to enter the password ftp2011. Just enter it and press return.

3) After finished the transferring, the files and folders are all in ftp2011 account and same as ftp2010
Because I want it automatically, I saved it into a sh file named copyfiles.sh. Add a crontab task in Dreamhost web panel. Run it every two hours.
There is still a problem for password entering. I doing search on Dreamhost wiki and find the post of passwordless ssh login. It can solve this problem.

David Yin

David is a blogger, geek, and web developer — founder of FreeInOutBoard.com. If you like his post, you can say thank you here

Leave a Reply

Your email address will not be published. Required fields are marked *