Batch File Copy Check If Directory Exists Before Copying If Exist Copy If Not Exist Dont Copy

This Batch File  must copy the file as seen  in such a way if the file does not exist copy it, if it exists don't copy it.
LVL 9
stressedout2004Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

stressedout2004Author Commented:
If NOT Exist "C:\Program Files (x86)\Mozilla Firefox\browser\extensions\plugin@okta.com.xpi" goto EXISTSxpi
:EXISTSxpi
copy /y "\\vir-storage\common\SHARED\IT Department\OktaBrowserPlugins\plugin@okta.com.xpi" "C:\Program Files (x86)\Mozilla Firefox\browser\extensions\"


If NOT Exist "C:\Program Files (x86)\Mozilla Firefox\okta-mozilla.cfg" goto EXISTScfg
:EXISTScfg
copy /y "\\vir-storage\common\SHARED\IT Department\OktaBrowserPlugins\okta-mozilla.cfg" "C:\Program Files (x86)\Mozilla Firefox\"


If NOT Exist "C:\Program Files (x86)\Mozilla Firefox\defaults\pref\okta-prefs.js" goto :EXISTSjs
:EXISTSjs
copy /y "\\vir-storage\common\SHARED\IT Department\OktaBrowserPlugins\okta-prefs.js" "C:\Program Files (x86)\Mozilla Firefox\defaults\pref\"


If NOT Exist "C:\Program Files\Mozilla Firefox\browser\extensions\plugin@okta.com.xpi" goto EXISTS64xpi
:EXISTS64xpi
copy "\\vir-storage\common\SHARED\IT Department\OktaBrowserPlugins\plugin@okta.com.xpi" "C:\Program Files\Mozilla Firefox\browser\extensions\"


If NOT Exist "C:\Program Files\Mozilla Firefox\okta-mozilla.cfg" goto EXISTS64cfg
:EXISTS64cfg
copy  "\\vir-storage\common\SHARED\IT Department\OktaBrowserPlugins\okta-mozilla.cfg" "C:\Program Files\Mozilla Firefox\"


If NOT Exist "C:\Program Files\Mozilla Firefox\okta-prefs.js" goto EXISTS64js
:EXISTS64js
copy "\\vir-storage\common\SHARED\IT Department\OktaBrowserPlugins\okta-prefs.js" "C:\Program Files\Mozilla Firefox\defaults\pref\"

Open in new window

0
NVITEnd-user supportCommented:
If NOT Exist "C:\Program Files (x86)\Mozilla Firefox\browser\extensions\plugin@okta.com.xpi" copy /y "\\vir-storage\common\SHARED\IT Department\OktaBrowserPlugins\plugin@okta.com.xpi" "C:\Program Files (x86)\Mozilla Firefox\browser\extensions\"

If NOT Exist "C:\Program Files (x86)\Mozilla Firefox\okta-mozilla.cfg" copy /y "\\vir-storage\common\SHARED\IT Department\OktaBrowserPlugins\okta-mozilla.cfg" "C:\Program Files (x86)\Mozilla Firefox\"

If NOT Exist "C:\Program Files (x86)\Mozilla Firefox\defaults\pref\okta-prefs.js" copy /y "\\vir-storage\common\SHARED\IT Department\OktaBrowserPlugins\okta-prefs.js" "C:\Program Files (x86)\Mozilla Firefox\defaults\pref\"

If NOT Exist "C:\Program Files\Mozilla Firefox\browser\extensions\plugin@okta.com.xpi" copy "\\vir-storage\common\SHARED\IT Department\OktaBrowserPlugins\plugin@okta.com.xpi" "C:\Program Files\Mozilla Firefox\browser\extensions\"

If NOT Exist "C:\Program Files\Mozilla Firefox\okta-mozilla.cfg" copy  "\\vir-storage\common\SHARED\IT Department\OktaBrowserPlugins\okta-mozilla.cfg" "C:\Program Files\Mozilla Firefox\"

If NOT Exist "C:\Program Files\Mozilla Firefox\okta-prefs.js" copy "\\vir-storage\common\SHARED\IT Department\OktaBrowserPlugins\okta-prefs.js" "C:\Program Files\Mozilla Firefox\defaults\pref\"

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
stressedout2004Author Commented:
Thank you that worked.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Batch

From novice to tech pro — start learning today.