?
Solved

Poll or search a folder for new files

Posted on 2003-11-29
5
Medium Priority
?
1,637 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 252 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 248 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
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…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

770 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