Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Still get output to file if no file exists  (Read 5914 times)

0 Members and 1 Guest are viewing this topic.

Mia

  • Guest
Still get output to file if no file exists
« on: July 21, 2004, 09:13:41 AM »
Written a simple batch file that runs every minuet and will ftp files to another machine and outputs results to a log file.
Unfortunately with using *.* it still tries to ftp and outputs to the log that no files where copied.
We want it to only write to the log file if it does something. This is fine if you put *.pdf but not *.*
This is the batch file as it is now.
------------------
@echo off
E:
cd "\workflow\administration\direct input"

if exist *.* goto COPY

goto END

:COPY

FTP -n -i -s:d:\scripts\workflow.scr >>d:\scripts\logs\workflow.log

move /Y *.* ..\postftp
:END

How can we still have all files rather than specify a type and get it to skip to END when the folder is empty?

Thank you for your time.
Mia  

MalikTous

  • Guest
Re: Still get output to file if no file exists
« Reply #1 on: July 21, 2004, 11:49:20 AM »
If there is a specific file that is always existent in the directory when it is used (such as TOC.TXT), have the test check for that vice *.* Or if you generate PDF or DOC or TXT files invariably to the directory every time it is in use, key on the extension (*.PDF) for the initial test.

Testing for *.* is like testing for nul: in a directory, it only verifies that the directory exists.

You might also use an if loop and ERRORLEVEL to report on attempts to copy and move, and skip reporting and FTPing if there are no files that way.