Home / Microsoft / Microsoft DOS / Still get output to file if no file exists
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] - (Bottom) Print
Author Topic: Still get output to file if no file exists  (Read 1336 times)
Mia
Guest
« 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  
IP logged
MalikTous
Guest
« 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.
IP logged
Pages: [1] - (Top) Print 
Home / Microsoft / Microsoft DOS / Still get output to file if no file exists « previous next »
 


Login with username, password and session length

Old Forum Search | Forum Rules
Copyright © 2010 Computer Hope ® All rights reserved.
Powered by SMF 2.0 RC3 | SMF © 2006–2010, Simple Machines LLC
Page created in 0.103 seconds with 18 queries.