【问题标题】:Need to create a folder in remote server usint ant需要使用ant在远程服务器中创建文件夹
【发布时间】:2011-09-16 02:34:33
【问题描述】:

使用 ant scp 我可以将文件从本地系统(windows)复制到服务器(linux)。所以我需要的是我想使用 ant 在 linux 系统中的指定目录中按系统日期创建一个文件夹并复制文件到创建的文件夹中..

这是我的 ant 脚本:

<sshexec host="hostname:22" username="****" trust="true"
     password="fcubs" 
     command="mkdir $/home/desktop/<folder to be creted here>"/>
   <scp todir="username@hostname:/home/desktop" password="*****" trust="true">
      <fileset dir="D:\kkk"/>
   </scp>

请帮助我 提前致谢

【问题讨论】:

    标签: ant scp


    【解决方案1】:

    你可以使用这样的 linux 命令来创建目录:

    export ATD=`date '+%h-%d-%Y_%H:%M:%S'` && cd /path/to/specified/dir && mkdir $ATD && cd $ATD
    

    它将在目录 /path/to/specified/dir 中创建目录(例如)“Nov-14-2012_17:41:02”,并将 cd 到它。

    执行此命令后,您只需将文件复制到目录即可。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-08-23
      • 2011-09-30
      • 1970-01-01
      • 1970-01-01
      • 2015-07-29
      • 1970-01-01
      • 2016-09-26
      • 2013-10-27
      相关资源
      最近更新 更多