Forums before death by AOL, social media and spammers... "We can't have nice things"
|    alt.msdos.batch.nt    |    Fun with Windows NT batch files    |    68,980 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 67,203 of 68,980    |
|    Zaidy036 to Paul Emmons    |
|    Re: Is file movable before being moved?    |
|    08 May 18 22:33:49    |
      From: Zaidy036@isp.spam              On 5/8/2018 2:47 AM, Paul Emmons wrote:       > I have a batch program that copies groups of files to two other       > drives and then moves them to another directory on the source       > drive. Occasionally it does not completely succeed because one of       > the target files is in use by a program. Now that the MOVE command       > returns errorlevel 1 if there is any problem, it should be possible       > to detect this condition early on, inform me, and abort.       >       > One way, I suppose, is first to move the files to a temporary       > directory used only by this batch program, note the errorlevel, and       > move them back to the original location. But I wonder whether       > there is a way to determine whether a file can be moved without       > actually trying to move it. (The desired files are indicated by       > an argument with question marks and asterisks. After they are       > moved to the ultimate destination directory, an attempt to move or       > copy them from there might conceivably involve other files that       > should not be touched.)       >       Not sure if this will help but if a file is locked because it is being       written to the following can be used:              :: _TT is a full file name              :WriteCheck       TIMEOUT 30 > NUL & :: seconds to wait between checks       CALL >>%_TT% > NUL       IF ERRORLEVEL 1 GOTO _WriteCheck & :: File is still locked for recording       --       Zaidy036              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca