Solved

Access FTP

Posted on 2014-07-25
6
450 Views
Last Modified: 2014-08-04
I have code (got from EE) that puts files on an FTP server: -
   
strFTPServ = "ftp1.test.net"
    strGet = Filename
    'Mounting file command for ftp.exe
    lngNum = FreeFile()
    Open "C:\temp\" & "\FtpComm.txt" For Output As #lngNum
    Print #1, "bin"
    Print #1, "user " & "username" & " " & "Password"
    Print #1, "cd /Route"
    Print #1, "put " & strGet ' Send File
    Print #1, "close" ' close connection
    Print #1, "quit" ' Quit ftp program
    Close
    strShell = "ftp -i -n -s:" & "C:\temp\" & "FtpComm.txt " & strFTPServ
    Shell strShell

Open in new window


The ftp server has a folder called Confirmations and I want to get all files from that folder copy to my PC then delete them from the server. Can anyone help with the syntax?
0
Comment
Question by:HKFuey
  • 3
  • 2
6 Comments
 
LVL 17

Accepted Solution

by:
Barry Cunney earned 350 total points
ID: 40219680
strFTPServ = "ftp1.test.net"
    strGet = "*"
    'Mounting file command for ftp.exe
    lngNum = FreeFile()
    Open "C:\temp\" & "\FtpComm.txt" For Output As #lngNum
    Print #1, "bin"
    Print #1, "user " & "username" & " " & "Password"
    Print #1, "cd /Confirmations"
    Print #1, "get " & strGet ' Retrieve File
    Print #1, "close" ' close connection
    Print #1, "quit" ' Quit ftp program
    Close
    strShell = "ftp -i -n -s:" & "C:\temp\" & "FtpComm.txt " & strFTPServ
    Shell strShell

Open in new window

0
 

Author Comment

by:HKFuey
ID: 40224286
Hi Barry,

I tried this and it runs without error but gets no files. I even tried replacing  "*" with an actual file name on the server.

Andy
0
 
LVL 57

Assisted Solution

by:Jim Dettman (Microsoft MVP/ EE MVE)
Jim Dettman (Microsoft MVP/ EE MVE) earned 150 total points
ID: 40224411
Andy,

 Since your scripting this, then what I would suggest is doing exactly what your script is doing, but do it manually.

 You'll quickly find where the problem is.

Jim.
0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 

Assisted Solution

by:HKFuey
HKFuey earned 0 total points
ID: 40226281
0
 
LVL 57
ID: 40226325
I really don't see why you needed it....you were already there.  Barry gave you the corrected command (a get instead of a put) and as the article said, the toughest part is coming up with the correct commands.

  That's why I suggested walking through your script commands manually.   I could have posted all my own FTP routines,  but you'd quickly find that the actual commands vary by the type of FTP server your talking to, what type of FTP is being used, and what FTP client your using.  

For example, there Unix vs DOS mode for directory listing formats, FTP, sFTP, and FTPs for transmission methods, and some clients allow the use of MGet  (Multiple file get) while others do not.

 The fastest way to learn all that is to try the commands manually.  

Jim.
0
 

Author Closing Comment

by:HKFuey
ID: 40238523
Thanks. The link I posted saved me lots of time.
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question