Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I'm trying to write a batch file that will loop repeatedly every two minutes (using a multiple ping to a non-existent IP for delay).
It will effectively move files over the network to an NT 4.0 server. Then delete the original after verifying each file has been safely copied.
I'm not familiar with the for batch command, but I think it might do the job.
(I would use move exist, and delete, but I think the xcopy /v function is more reliable.)

You could use the FOR command like this
c:
cd\dir
for %%f in (*.ext) if exist Z:\dir\%%f if exist %%f del %%fthis should do ... I guess (please test)
but beware of zero-byte files, and files which are used by other processes

That worked. Now I have to modify it to detect if a file has been completely copied before attempting to access it.
We have some pretty large files and the batch is inevitably going to try copying one before it's done.
I think an exist, then a delay, then the copy within the loop before might work, but I'd like a more positive error recovering script that would continue working without user intervention.

oops!
I just looked in the archives some more and think i found my answer.
"moving in-use files"
(My thought was to test for the "R" byte set, which would be the case if the file was still being copied. I'll try to figure out if that is possible if this doesn't do the trick for me. This batch has to run unatended for days and I hate getting woken up in the middle of the night.)

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |