0

In my job I often have to move websites from one server to another.

Till now I zipped all the files from origin's server httpdocs to a backup.zip and downloaded it on new server with wget old_domain.com/backup.zip, after the downloaded I extracted the zip file.

Is there a way, to wget all files from old_domain.com?

Something like wget example.com/* did not work.

I'm always have the root access to the origin's server.

It would be really great, when I can't avoid the .zip file, because the backups are about 50GB and packing & extracting take more than a hour.

1
  • wget is useful for mirroring someone else’s website but it cannot transfer any server-side scripts and files that no page links to. If you are the maintainer of the origin server, you should prefer FTP, SCP or similar methods.
    – Melebius
    Feb 20, 2019 at 11:06

1 Answer 1

1

You can use wget over FTP, like this:

wget -m \
    --user=$FTPUSERNAME --password=$FTPPASSWORD \
    -o $LOGFILE -P $LOCALDIR ftp://example.com/sourcedir

with -m: use mirroring and -P: target directory.

4
  • thanks a lot, I just do not understand what is mirroring... Do I see right: 'wget -m \ --user=$FTPUSERNAME --password=$FTPPASSWORD \ -o $LOGFILE -P /var/www/vhosts/my_domain/httpdocs example.com/httpdocs' is one line? Which one will be faster: zip > wget file.zip > unzip oder wget ftp://...?
    – GoodGuy
    Feb 20, 2019 at 17:17
  • No, on one line, you would leave out the ``. As for speed, zipping on the server (i.e. before downloading) may be faster if network speed is a problem. But I don't like the extra step. BTW for this kind of job I normally use Filezilla.
    – Jos
    Feb 20, 2019 at 17:27
  • So one line would be 'wget -m --user=$FTPUSERNAME --password=$FTPPASSWORD -o $LOGFILE -P /var/www/vhosts/my_domain/httpdocs example.com/httpdocs' ? Downloading via wget it's about 11Mbit, but I don't know which speed will be via ftp. Filezilla ist not an option, cuz I use mobile internet
    – GoodGuy
    Feb 20, 2019 at 17:40
  • I tried that out and found out, that zip > wget > unzip is faster than wget from ftp. Thank you
    – GoodGuy
    Feb 24, 2019 at 16:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.