Solved

Automated Polling & FTP Transfer question

Posted on 2001-07-16
6
645 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
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.

 
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

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

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.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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 Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

863 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

23 Experts available now in Live!

Get 1:1 Help Now