Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am having two domains and i need to copy some file from one domain to another.

cp http://domain2/crontest/

I tried above but it dint work. Is there any other way?

share|improve this question
up vote 1 down vote accepted

The Unix/Linux cp command uses filesystem paths, not URLs.

If the two domains are served from the same server, and you have admin access to the whole server (it is not hosted by a hosting company) you can do the copy by converting the URLs to filesystem paths by prepending the document root "docroot" for each site to the path portion of the URL.

If the docroot for domains 1 and 2 is /var/www/domain1 and /var/www/domain2

 cp /var/www/domain1/test.xml /var/www/domain2/

If the sites are on separate servers and you have ftp access to at least one and shell access to another, you can just use ftp

  $ cd /var/www/site1
  $ ftp
  user: mubasshir
  password: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  > cd relativedocroot
  > get test.xml
  > quit

You can script this for cron - read the manpage

Instead of using ftp you can also use wget

  $ cd /var/www/site1
  $ wget http://domain2/crontest/test.xml
share|improve this answer
no they are not same server. – Mubasshir Pawle Jan 24 '12 at 14:07
@mubasshir: see updated answer - I'd use wget. – RedGrittyBrick Jan 24 '12 at 14:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .