Solved

Automated Polling & FTP Transfer question

Posted on 2001-07-16
6
644 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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

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.

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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 …
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

706 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

21 Experts available now in Live!

Get 1:1 Help Now