Solved

Automated Polling & FTP Transfer question

Posted on 2001-07-16
6
649 Views
Last Modified: 2011-09-20
The exact requirement is listed below.I want VB code for this:

I am building a VB application which will look(Poll) in different FTP Server(Unix,Windows) as well as in the C:/Filein directory for incoming files.If a fileis avaialable the application will process the file, move it to a separate directory & FTP it back to Unix server for processing. FTP to Unix server is OK to me & I know it.Main part I am looking for is the polling in different FTP servers & whenever file comes process it & put it in a separate directory.Any help will be very much appreciated.

Thanks
Himachal
0
Comment
Question by:himachal
6 Comments
 
LVL 2

Expert Comment

by:TrueDrake
ID: 6286845
Hi,

Since YOU're building a VB application, let's see you code up to now!

Enjoy
0
 
LVL 1

Accepted Solution

by:
jdesharnais earned 200 total points
ID: 6289992
I'm think what you are asking is how do i check if a file exists.
I would connect with verbose mode off the use the ls command to find if a file exists.
Here is an example of using ls with verbose mode on then off.


ftp> ls config.sys
200 PORT command successful.
150 Opening ASCII mode data connection for config.sys.
config.sys
226 Transfer complete.
12 bytes received in 0.00 seconds (12000.00 Kbytes/sec)
ftp> ls config.syd
200 PORT command successful.
550 config.syd: error 2.
ftp> verbose
Verbose mode Off.
ftp> ls config.sys
config.sys
ftp> ls config.syd
config.syd: error 2.
ftp>
0
 
LVL 1

Author Comment

by:himachal
ID: 6290437
Thanks for all your help.I am looking for how I can poll in a particular directory(Unix or Windows) for a file.Also note that I have to process the file only when it's being transfered to that directory.
0
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
LVL 1

Expert Comment

by:jdesharnais
ID: 6290614
So what you are saying is that at every x time interval you want to check is the file exists, if it does get it, delete the original, process it, then put it back to a different directory

I have done a lot of ftp but never in vb.  Here are some commands I found in the msdn library.


FtpFindFirstFile Function

--------------------------------------------------------------------------------

Searches the specified directory of the given FTP session. File and directory entries are returned to the application in the WIN32_FIND_DATA structure.

Syntax

HINTERNET FtpFindFirstFile(
    IN HINTERNET hConnect,
    IN LPCTSTR lpszSearchFile,
    OUT LPWIN32_FIND_DATA lpFindFileData,
    IN DWORD dwFlags,
    IN DWORD_PTR dwContext
);


Return Value

Returns a valid handle for the request if the directory enumeration was started successfully, or returns NULL otherwise. To retrieve a specific error message, call GetLastError. If the function finds no matching files, GetLastError returns ERROR_NO_MORE_FILES.






FtpCommand Function

--------------------------------------------------------------------------------

Allows an application to send commands directly to an FTP server.

Syntax

BOOL FtpCommand(
    IN HINTERNET hConnect,
    IN BOOL fExpectResponse,
    IN DWORD dwFlags,
    IN LPCTSTR lpszCommand,
    IN DWORD_PTR dwContext,
    OUT HINTERNET *phFtpCommand
);


Return Value

Returns TRUE if successful, or FALSE otherwise. To get a specific error message, call GetLastError.

Remarks

GetLastError can return ERROR_INTERNET_NO_DIRECT_ACCESS if the client application is offline. If one or more of the parameters are invalid, GetLastError will return ERROR_INVALID_PARAMETER.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7153475
Hi himachal,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept jdesharnais's comment(s) as an answer.

himachal, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 1

Expert Comment

by:Computer101
ID: 7182130
Comment from expert accepted as answer

Computer101
E-E Moderator
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Suggested Solutions

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

730 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