通过 Perl(或其他语言)中的 ftp 递归远程目录树,仅将文件层次结构信息填充到 MySQL 中 - 查找现有库

发布于 2024-11-17 12:07:34 字数 1499 浏览 2 评论 0原文

我想通过 FTP 使用远程目录中的信息(即不是文件/文件夹本身,而是它们的名称+其他信息)填充 MySQL 数据库,保留文件的分层位置。

我正在寻找执行部分或全部操作的现有库,特别是解析从 ftp 输出返回的文本/字符串。

我已经在这里做了一些研究,但没有发现任何足够接近的东西:

我将使用以下方法在MySQL中存储文件层次结构:

只是想在我可能重新发明轮子之前先问一下。如果我没有得到答案,我会假设我所要求的内容还不完全存在,所以我会发布我的方法(就像我在此处发布的其他不同问题一样)。如果您能提供建议,请提前致谢。

使用 Perl 来执行此操作不是强制性的,任何其他跨平台语言都可以,例如 C、C++、Java、PHP、Python。只是我目前对 Perl 很“熟悉”,使用它做了很多工作,但我对其他语言持开放态度,这些语言已经用列出的大多数语言进行了广泛的编程。

I want to populate a MySQL database with the information (i.e. not the files/folders themselves but their names+ other info) from a remote directory via FTP, retaining the hierarchical positions of the files.

I'm looking for existing libraries that do some or all of this, particularly the parsing of the text/strings returned from ftp output.

I've done some research here already but not found anything quite close enough:

I would use the following approach to store the file hierachy in MySQL:

Just thought I would ask before I potentially re-invent the wheel. If I don't get answers I'll assume what I'm asking for doesn't exist in entirety yet so I would post what my approach would be (as I have done with other, different questions I have posted here). Thanks in advance if you can offer advice though.

Using Perl to do this is not mandatory, any other cross platform language would be OK, e.g. C, C++, Java, PHP, Python. It's just that I'm "in-the-zone" with Perl doing a lot of work using it at the moment but am open to other languages having programmed extensively with most of those listed.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我不会写诗 2024-11-24 12:07:34

使用 ncftpls 你可以列出远程目录,然后你可以用Perl 或任何其他语言。您将需要 -R 选项来递归子目录。

ncftpls -R ftp://ftp.example.com/

With ncftpls you can do a remote directory listing, and then you can parse it with Perl or any other language. You will need the -R option to recurse through subdirectories.

ncftpls -R ftp://ftp.example.com/
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文