Solved

Automated Polling & FTP Transfer question

Posted on 2001-07-16
6
653 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
[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
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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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 …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

696 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