Solved

Poll or search a folder for new files

Posted on 2003-11-29
5
1,636 Views
Last Modified: 2013-12-03
I have to automate some FTP functions.  We have files dropped off on our FTP server at different times and we need them automatically encrypted and/or FTP'd to another server.
I can do the enctyption via pgp command line and also the ftp via .bat files but the search/polling function is out of my relm.

Is there any way to create a vbscript or .bat file that will search or "poll" a folder every 10 or so minutes for new files that has been placed in it, then encrypt and upload it to an ftp server?


Thanks,
Barry
0
Comment
Question by:bggtech
[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
5 Comments
 
LVL 32

Accepted Solution

by:
jhance earned 63 total points
ID: 9844960
Use:

HANDLE FindFirstChangeNotification(
  LPCTSTR lpPathName,    // directory name
  BOOL bWatchSubtree,    // monitoring option
  DWORD dwNotifyFilter   // filter conditions
);

BOOL FindNextChangeNotification(
  HANDLE hChangeHandle   // handle to change notification
);

Example code:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/obtaining_directory_change_notifications.asp
0
 
LVL 16

Assisted Solution

by:_nn_
_nn_ earned 62 total points
ID: 9845800
I posted a link to a special tool in this thread : http:Q_20810699.html
The script proposed by the other expert would fit your need as well I think. Just replace the processing (in that example, it just deletes files judged too old) by the one you need (encrypt and upload). As for the scheduled run, in case you can't use the OS-based scheduling facilities, a simple script like following one would probably be enough :

@echo off
:endless
:: this is your "normal" processing batch
call encrypt_and_upload.bat
:: if you have the RK, you can probably use sleep.exe instead of followinf "trick"
ping -n 601 127.0.0.1 >NUL
:: after 10 minutes, we just loop
goto endless


The advantage of using the APIs mentioned by jhance is that you're notified immediately and files can be processed instantly. If you have a development environment, the coding shouldn't be much of a problem.
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

705 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