FG
💻 Software

Batch real time wait for a file

Fresh5 days ago
Mar 15, 202616074 views
Confidence Score0%
0%

Problem

I have some batch scripts which wait for files. The wait loop is done with the typical IF EXISTS loop: I am looking for a more efficient way of waiting for files. Something like a waitfile.exe command which will block and wait until the file appears. Internally, it should use the FileSystemWatcher …

Error Output

:waitloop
IF EXISTS file.zip GOTO waitloopend
sleep.exe 60
goto waitloop
: waitloopend

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Batch real time wait for a file

Low Risk

Your method is preferable and perfectly acceptable. wastes resources, even more than your loop. Even if you make your loop as tight as with one second delay, you'll still be totally unnoticeable in any process monitor that measures CPU or hard disk …

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment