Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Poll or search a folder for new files

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

Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

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

What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
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 response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

609 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