PHP通过FTP下载整个文件夹(递归) [英] PHP download entire folder (recursive) via FTP

查看:153
本文介绍了PHP通过FTP下载整个文件夹(递归)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前有一个非常大的网站,大约5gb的大小,60,000个文件。目前的主持人并没有太多的帮助我将网站转移到新的主机,而是在我的新主机上做一个简单的脚本来FTP到旧主机,并下载整个public_html文件夹(递归地) )到新的服务器。这是否可能,如果是,有没有人有任何链接,他们可以分享帮助这一点?非常感谢。

解决方案

可能有更好的机制来做你想做的事。



首先,你可以从一个主机到另一个主机使用 sftp scp

  scp -R username @ oldhost:path / to / directory / / path / to / destination / directory 

  sftp username @ oldhost #然后使用'get -r'递归地下载

  rsync -avz -P username @ oldhost:/ path / to / directory / / path / to / destination / directory / 

-P 可以轻松重新启动停止/死机的下载。



如果好的工具不起作用,那么看看是否安装了 wget

  wget --mirror --continue --ftp-user = username ftp:// oldhost / path / to / directory / 

- 继续使得更容易重新启动一个停滞/死亡的下载。


I currently have a very large site approximately 5gb in size with 60,000 files. The current host isn't doing much in the way of helping me transfer the site to the new host and what I was thinking was to make a simply script on my new host to FTP into the old host and download the entire public_html folder (recursively) to the new server. Is this possible and if so, does anyone have any links they could share to aid in this? Much appreciated.

解决方案

There are probably better mechanisms to do what you want to do.

First, can you use sftp or scp from one host to the other?

scp -R username@oldhost:path/to/directory/ /path/to/destination/directory

or

sftp username@oldhost  # then use 'get -r' to download recursively

or

rsync -avz -P username@oldhost:/path/to/directory/ /path/to/destination/directory/

The -P makes it easy to restart a stalled/dead download.

If good tools won't work, then see if wget is installed:

wget --mirror --continue --ftp-user=username ftp://oldhost/path/to/directory/

The --continue makes it easier to restart a stalled/dead download.

这篇关于PHP通过FTP下载整个文件夹(递归)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆