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?
 
NVITCommented:
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
 
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
 
stressedout2004Author Commented:
Thank you that worked.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.