lftp将文件上传到不同文件夹

时间:2017-01-21 11:05:10

标签: ftp lftp

我需要将具有相同名称的不同文件夹中的文件递归到远程文件夹。这是一个例子。

Local
   |-app1-1  
   |      |-src
   |      |-img
   |      |-static
   |          |-app1-2      <------Upload from this
   |              |-file1-1
   |              |-file1-2
   |-app2-1  
   |      |-src
   |      |-img
   |      |-static
   |          |-app2-2      <------Upload from this
   |              |-file2-1
   |              |-file2-2

这是我需要的远程结果。

Remote Result
   |-folder1
   |-folder2
   |-folder3
   |-static
   |    |-app1-2      <------Upload from this
   |    |     |-file1-1
   |    |     |-file1-2
   |    |  
   |    |-app2-2      <------Upload from this
   |    |     |-file2-1
   |    |     |-file2-1

我使用这样的脚本进行测试:

  - >
  lftp
  -e "mirror
  --include ^static/
  --exclude ^\.git.*
  -eRv $CI_PROJECT_DIR Remote Result/static; quit;"
  sftp://$CREDENTIALS

但这会产生不希望的输出:

Remote Result
  |-folder1
  |-folder2
  |-folder3
  |-static
  |    |-app1-1      <------Upload from this
  |    |     |-static
  |    |         |-app1-2
  |    |            |-file1
  |    |            |-file2

  ...... (Same other folder)

0 个答案:

没有答案