PHP通过FTP下载整个文件夹(递归) [英] PHP download entire folder (recursive) via FTP
问题描述
可能有更好的机制来做你想做的事。
首先,你可以从一个主机到另一个主机使用 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屋!