从远程计算机上的蚂蚁,下载文件集

编程入门 行业动态 更新时间:2024-10-24 01:58:03
本文介绍了从远程计算机上的蚂蚁,下载文件集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

因为我已经读进来的蚂蚁通过scp任务下载从远程计算机文件时,不提供文件集属性。从本地计算机发送文件时,它的工作原理,但在远程计算机启动时它不工作。这是一个从文档。因此,在远程机器我在每一个目录中的一些文件夹和文件的负荷。我想从他们每个人的下载所有文件夹和一个指定的文件。下载的所有文件,然后删除不需要的文件将不解决怎么一回事,因为有成千上万的文件。

As I've readen ant doesn't provide 'fileset' attribute when downloading files from remote machine via scp task. It works when sending files from local machine, but It doesn't work when starting in remote machine. That's from documentation. So in remote machine I have some folders and load of files in every directory. I want to download all folders and one specified file from every of them. Downloading all files and then deleting unneeded files won't be solution beacuse there are thousands of files.

所以。如何下载的所有文件夹(只创建在没有内容的磁盘)从指定的目录中远程计算机,然后在远程机器上的每个目录下载一个指定的文件,并把它用蚂蚁对应的文件夹?

So. How to download all folders (only create the on disk without content) from specified directory in remote machine and then download one specified file from every directory in remote machine and put it to corresponding folder using ant?

推荐答案

既然你没有指定我会假设你的本地和远程系统是基于Unix,因此支持的 rsync的和ssh。

Since you haven't specified I'll assume that your local and remote systems are unix based and therefore support rsync and ssh.

一个更多的跨平台解决方案是具有挑战性的...

A more cross-platform solution is challenging...

生成一个SSH密钥(指定一个空密码):

Generate an SSH key (specify an empty passphrase):

ssh-keygen -f rsync

这会生成2个文件,对应的私钥和公钥:

This will generate 2 files, corresponding to the private and public keys:

|-- rsync `-- rsync.pub

在远程服务器上安装公共密钥

Install the public key on the remote server

ssh-copy-id -i rsync.pub user@remote

您现在可以进行无密码登录,使用SSH私钥测试验证:

Test that you can now perform a password-less login, using the ssh private key to authenticate:

ssh -i rsync user@remote

ANT

下载目标调用rsync将在本地复制远程文件系统树。如果需要,可以另外指定rsync的除外(参见rsync的DOCO)。

ANT

The "download" target invokes rsync to copy the remote file system tree locally. If required one can additionally specify rsync exclusions (see the rsync doco).

<project name="rsync" default="download"> <target name="download"> <exec executable="rsync"> <arg line="-avz -e 'ssh -i rsync' user@remote:/path/to/data/ data"/> </exec> </target> <target name="clean"> <delete dir="data"/> </target> </project>

更多推荐

从远程计算机上的蚂蚁,下载文件集

本文发布于:2023-11-11 18:03:19,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1579177.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:机上   蚂蚁   文件

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!