Option Compare Database
Option Explicit On
'==========================<
Form >===========================
Private Sub Form_Open(Cancel As Integer)
'--------< Form_Open()
>--------
tbxFolder_Local = CurrentProject.Path
'--------</ Form_Open() >--------
End Sub
'==========================</
Form >===========================
'==========================<
Buttons >===========================
Private Sub Btn_Get_FTP_Click()
'--------<
Btn_Get_FTP_Click() >--------
'< reset >
ctlStep = ""
ctlLog = ""
'</ reset >
fl_Download_FTP()
'--------</
Btn_Get_FTP_Click() >--------
End Sub
'==========================</
Buttons >===========================
'==========================<
Functions >===========================
' Shell variant
' Requires reference to
Microsoft Shell Controls and Automation
Private Sub fl_Download_FTP()
'--------<
fl_Download_FTP() >--------
'< get FileExplorer
Functions >
Dim myShell As Shell
myShell = New Shell
'</ get FileExplorer
Functions >
'< Local Folder >
addLog "get local
Folder"
Dim folder_Local As Folder 'Shell32.Folder on PC,
folder_Local =
myShell.Namespace(CurrentProject.Path)
'current folder of access
'</ Local Folder >
'< remote ftp-folder
>
'*get ftp folder, connect
addLog "get remote
FTP Folder"
Dim sFtp_URL As String
sFtp_URL = tbxFolder_Remote_FTP
Dim folder_Remote_Ftp As Folder
folder_Remote_Ftp =
myShell.Namespace(sFtp_URL) 'ftp://User:Password@ftp-IP
'</ remote ftp-folder
>
'folder_Remote_Ftp.CopyHere
folder_Local.Items.Item("Datei_1.csv")
'----< @Loop:
Folder-Items >----
Dim iFile As Long
iFile = 0
Dim varItem
For Each varItem In folder_Remote_Ftp.Items
'----< Folder-Item
>----
'< init >
iFile = iFile + 1
Dim sFilename As String
sFilename = varItem.Name
'</ init >
'< download text-files
>
addLog iFile & " " & sFilename
If sFilename Like "*csv" Then
'< download >
addLog "download " & sFilename
folder_Local.CopyHere
folder_Remote_Ftp.Items.Item(sFilename)
'</ download >
'< rename >
addLog "rename " & sFilename
folder_Remote_Ftp.Items.Item(sFilename).Name
= sFilename & "_done.csv"
'</ rename >
End If
'</ download text-files
>
'----</ Folder-Item
>----
Next
'----</ @Loop:
Folder-Items >----
'
MsgBox "ok "
'--------</
fl_Download_FTP() >--------
End Sub
'==========================</
Functions >===========================
|