Solved

Access FTP

Posted on 2014-07-25
6
436 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
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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 …
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
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, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

932 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

13 Experts available now in Live!

Get 1:1 Help Now