Computing.Net > Forums > Disk Operating System > xcopy and delete a group of files.

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

xcopy and delete a group of files.

Reply to Message Icon

Name: Bill Keiser
Date: October 31, 2002 at 10:07:33 Pacific
OS: Win2K
CPU/Ram: P/2gigs
Comment:

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.)



Sponsored Link
Ads by Google

Response Number 1
Name: Miskva
Date: October 31, 2002 at 10:23:05 Pacific
Reply:

You could use the FOR command like this

c:
cd\dir
for %%f in (*.ext) if exist Z:\dir\%%f if exist %%f del %%f

this should do ... I guess (please test)

but beware of zero-byte files, and files which are used by other processes


0

Response Number 2
Name: Bill Keiser
Date: November 4, 2002 at 07:19:06 Pacific
Reply:

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.


0

Response Number 3
Name: Bill Keiser
Date: November 4, 2002 at 08:24:38 Pacific
Reply:

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.)


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: xcopy and delete a group of files.

Suppressing “File not found” message www.computing.net/answers/dos/suppressing-file-not-found-message/9366.html

Dos is Great! www.computing.net/answers/dos/dos-is-great/6308.html

Undelete www.computing.net/answers/dos/undelete/9093.html