Solved

Access FTP

Posted on 2014-07-25
6
430 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

Assisted Solution

by:HKFuey
HKFuey earned 0 total points
Comment Utility
0
 
LVL 57

Expert Comment

by:Jim Dettman (Microsoft MVP/ EE MVE)
Comment Utility
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
Comment Utility
Thanks. The link I posted saved me lots of time.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

744 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now