Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Need a bat file to copy specific files from an autonumbered directory

Avatar of electricd7
electricd7 asked on
Windows Batch
23 Comments1 Solution582 ViewsLast Modified:
Hello.

I have a process that creates a numbered directory in the path "C:\CSIRP\Storage\".  The number is generated automatically and is different each day.  For example today's path is "C:\CSIRP\Storage\68".  Inside that directory there are approximately 100 files.  I need a batch file that will look at the root directory, "C:\CSIRP\Storage\", find the highest numbered subdirectory, today will be 66 tomorrow will be 67.  Then once I find the correct directory, I need to copy 4 files to path "\\servername\sharename".  The 4 files I need are ALWAYS named:

**CF0364, **DMCIF, **LMCIF, and **NMCIF

Where ** is the same as the number of the directory.  The batch will be scheduled to run multiple times daily, so before it copies the files, it should check the "\\servername\sharename" path for the existance of the files, and abort if the files already exist (no need to copy them twice.)

Please help if you can.