Solved

Access FTP

Posted on 2014-07-25
6
474 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 58

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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Suggested Courses
Course of the Month9 days, 3 hours left to enroll

617 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