Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Access FTP

Posted on 2014-07-25
6
Medium Priority
?
499 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 1050 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 58

Assisted Solution

by:Jim Dettman (Microsoft MVP/ EE MVE)
Jim Dettman (Microsoft MVP/ EE MVE) earned 450 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
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 

Assisted Solution

by:HKFuey
HKFuey earned 0 total points
ID: 40226281
0
 
LVL 58
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

885 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