File Copy and Rename problems

  • Thread starter Thread starter Ben
  • Start date Start date
B

Ben

We generate files every night in a dir and I need the most recent files
to be copied to a separate dir and renamed.

I have tried the below script and it worked fine the first time and then
generated errors saying the file was in use by another process.

When looking in the log for the batch script I discovered that the
program was asking if I wanted to overwrite the file. I am assuming
that this kept the process open and is waiting for a response.

Could someone please help me:

1. How do I kill this batch process other than using task manager?
2. How can I modify the below script to make it better?


Thanks for your assistance

-Ben M


@echo off
COPY
C:\filename\filename\filename\filename\filename.%Date:~-4,4%%Date:~-10,2%%Date:~-7,2%******
C:\filename\filename\filename\filenameCOPY
C:\filename\filename\filename\filename\filename%Date:~-10,2%%Date:~-7,2%%Date:~-4,4%.******
C:\filename\filename\filename\filename>>C:\filename\filename\filename\filename\filename.log
 
You can use Kill.exe from the Support Tools on the Server CD-ROM, or the
freeware at tip 431 in the 'Tips & Tricks' at http://www.jsiinc.com or
see tip 4010.

You can use an
if exist filename del /q filename
beofre the copy.



We generate files every night in a dir and I need the most recent files
to be copied to a separate dir and renamed.

I have tried the below script and it worked fine the first time and then
generated errors saying the file was in use by another process.

When looking in the log for the batch script I discovered that the
program was asking if I wanted to overwrite the file. I am assuming
that this kept the process open and is waiting for a response.

Could someone please help me:

1. How do I kill this batch process other than using task manager?
2. How can I modify the below script to make it better?


Thanks for your assistance

-Ben M


@echo off
COPY
C:\filename\filename\filename\filename\filename.%Date:~-4,4%%Date:~-10,2%%Date:~-7,2%******
C:\filename\filename\filename\filename
COPY
C:\filename\filename\filename\filename\filename%Date:~-10,2%%Date:~-7,2%%Date:~-4,4%.******
C:\filename\filename\filename\filename>>C:\filename\filename\filename\filename\filename.log


Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 
Back
Top