使用Powershell将文件从FTP复制到ADLS

时间:2018-06-13 17:15:33

标签: powershell azure azure-data-lake

我正在尝试使用Powershell将所有存档从FTP中的文件夹提取到Azure Data Lake Store。我只能在ADLS上或内部移动文件时找到documentation,但不能从ADLS以外的来源找到。{/ p>

我熟悉Copy-Item,但我不知道如何在Destination下访问ADLS(和输入凭据)。

   Option Explicit
    Public wkbk As Workbook
    Public mybook As Workbook

    Sub Opentrading()

    Dim FolderPath As String
    Dim Path As String
    Dim nyear As String
    Dim nmont As String
    Dim nday As String
    Dim LastRow As Long
    Dim LastColumn As Long

    Dim StartCell As Range
    Dim sht As Worksheet

    FolderPath = "filename"
    nyear = Sheet6.Range("J3")
    nmont = Sheet6.Range("J5")
    nday = Sheet6.Range("J7")
    Path = FolderPath & "\" & nyear & "-" & nmont & "-" & nday &  Southern_Europe" & ".xlsx"
    Set mybook = ThisWorkbook
    mybook.Worksheets("Data").UsedRange.ClearContents
    mybook.Worksheets("Data").Cells.ClearFormats
    Set wkbk = Workbooks.Open(Path)
    Set sht = wkbk.Sheets("Southern_Europe")

    'Find Last Row and Column
    Set StartCell = sht.Range("D1")
      LastRow = sht.Cells(sht.Rows.Count, StartCell.Column).End(xlUp).Row
      LastColumn = sht.Cells(StartCell.Row, sht.Columns.Count).End(xlToLeft).Column

    'Copy paste
     wkbk.Worksheets("Southern_Europe").Range(StartCell, sht.Cells(LastRow, LastColumn - 5)).Copy mybook.Worksheets("Data").Range("A1")

    'Autofit
     With mybook.Worksheets("Data")
                .UsedRange.Columns.AutoFit
                .Range("A1:S1").Interior.Color = RGB(0, 0, 0)
    '            .Range(StartCell, sht.Cells(LastRow, LastColumn - 5)).BorderAround LineStyle:=xlContinuous
    '            .Range(StartCell, sht.Cells(LastRow, LastColumn - 5)).Borders(xlInsideHorizontal).LineStyle = xlContinuous
        End With

      wkbk.Close
    End Sub

1 个答案:

答案 0 :(得分:0)

事实证明您需要使用Import-AzureRmDataLakeStoreItem

Import-AzureRmDataLakeStoreItem -AccountName ___ -Path ____ -Destination ___

这允许您在-Path。

下设置FTP文件路径