因为我已经读进来的蚂蚁通过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@remoteANT
下载目标调用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>更多推荐
从远程计算机上的蚂蚁,下载文件集
发布评论