Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script to poll a directory.

Status
Not open for further replies.
May 21, 2004
21
US
I do not know if I am using the right forum but....

I am looking for a script to poll a directory for a file, example.txt, and if the script finds the file ftp the file to another directory.
 
Why would you want to FTP the file to another directory? Wouldn't a copy or move do the job?

Also, you may want to post under the VBScript forum.
 
VB is better, but this can be done via a batch script using the "IF EXIST" syntax and an SCP file for the FTP commands:

Here is the syntax, note this is basically a "death loop" unless it finds a file or you Ctrl-C, or put in some other form of breaking out.

---------------------------
SET PATHNAME=C:\PATH\
SET FILENAME=file.txt
SET FTPSCPFILENAME=ftpcommands.scp
SET FTPLOGFILE= C:\LOGFILE.TXT
:BEGIN
IF EXIST %PATHNAME%%FILENAME% GOTO FTPFILE
GOTO BEGIN

:FTPFILE
FTP -s:%PATHNAME%%FTPSCPFILENAME% >> %FTPLOGFILE%
GOTO BEGIN
---------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top