I am trying to deploy a WordPress website from a test server to a production server. wget seems to be an efficient solution for transferring lots of files between 2 servers via FTP.

I connect to the target server, go to the /var/www folder, and I type :

wget -r ftp://fred:password@ftp.myserver.com/mywebsite/

I runs 2 minutes and then states that 2312 files have been transferred. Well, but Filezilla would find over 5000 files ! At first, I notice that the .htaccess file was ignored.

How does it come not all files have been handled by wget?

How can I specify that I need all the files to be transferred?

  • are you sure merely .htaccess was ignored ? moreover, all hidden files was ignored ? – Rahul May 12 '16 at 5:53
  • Because you aren't allowed to access them... Also use ftp to ftp things. – 123 May 12 '16 at 7:04
  • I am sure about .htaccess, I'll check for the other files ... – user1185081 May 12 '16 at 7:04
  • To 123, actually, I can access all the files using FileZilla with the same credentials. – user1185081 May 12 '16 at 7:06
  • Have you tried Curl is more about streams and wget is more about copying – Mongrel May 12 '16 at 11:52

The default recursion depth limit in wget is 5. This is primarily meant for the web where a large recursion is often a mistake, but the default also applies to FTP. Large recursion could also be a problem with FTP if the server has upward-pointing symbolic links.

To make a complete mirror, pass -l -1 to make the recursion unlimited, or better, pass the --mirror option.

  • wget -m works fine for mirroring (deploying) my website. I initially thought that .htaccess was ignored, but ls -all revealed the hidden file. – user1185081 May 13 '16 at 14:28

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.