Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xcopy in batch

Status
Not open for further replies.

inforeqd

Technical User
Jan 8, 2001
95
US
I asked this question a few weeks ago and got a quick
response, however I didnt think of something so I'm back
hopefully to find an answer.

The batch script uses xcopy to copy files from my source dir
to a destination directory. I'm using the /D and /Y to avoid prompting and also to not do a copy if a file exists in the destination directory with the proper timestamp criteria. However, I forgot to mention that I have another process that reviews and deletes the files in the destination directory. Therefore when the xcopy runs it just makes redundant copies in the destination since the /D criteria is no longer met.

How can I make sure that it wont copy a file thats already been copied??

Hope that explains things .. kinda wordy.

TIA
inforeq
 
It would be very difficult to do that in a batch. What you want is for the copy program to somehow remember what it copied in the past and not copy it again. This sort of data persistence is difficult at best with batches.

I would recommend using VBScript. Then you could easily maintain data persistence either in a flat text file or ideally in a database.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
robocopy will be much better

-----
Directory Services/Exchange Consultant
 
Will robocopy provide the ability to remember what it copied last week and not copy that file today? That is what I thought he wanted.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top