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:

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

robocopy and if else in batch file

Avatar of YZlat
YZlatFlag for United States of America asked on
Microsoft DOSShell Scripting
6 Comments1 Solution1753 ViewsLast Modified:
What I am trying to do is check if a folder Test exists on a desktop and if it does not, then I want to copy that folder from the server. And if it already exists, then I want to just copy the files from folder Test on the server into the existing folder on the desktop. And if existing folder contains any files I don't want the purged.  Below is the if else statement I use and it works great if folder does not exist but does nothing if folder already exists on the desktop. What am I doing wrong?

P.S. I want to use robocopy for copying the folder ot the files

if not exist "C:\Documents and Settings\All Users\Desktop\Test" 
robocopy "\\Server03\data\Test" "C:\Documents and Settings\All Users\Desktop\Test" /E
robocopy "\\Server03\data\Test" "C:\Documents and Settings\All Users\Desktop\Test" /COPY:DAT
Avatar of cjrmail2k
cjrmail2kFlag of United Kingdom of Great Britain and Northern Ireland image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

This problem has been solved!
Unlock 1 Answer and 6 Comments.
See Answers