Skip to content

Instantly share code, notes, and snippets.

@sdesalas
Last active August 29, 2015 14:03
Show Gist options
  • Save sdesalas/bdc77ecf852ec0cd34c9 to your computer and use it in GitHub Desktop.
Save sdesalas/bdc77ecf852ec0cd34c9 to your computer and use it in GitHub Desktop.
Ignores errors when copying a folder that doesnt exist
:: 1) Connect to remote server
net use \\fileserver\packages\myproject
:: 2) Backup previous package
move /y "\\fileserver\packages\myproject\prod\${APP_VERSION}\" "\\fileserver\packages\myproject\prod\${APP_VERSION}.#${releasetag}"
if %%errorlevel%% GEQ 1 goto filenotfound
goto okay
:: 3) Ignore errors
:filenotfound
rem Ignoring File-not-Found errors..
:okay
:: 4) Recreate directory
mkdir "\\fileserver\packages\myproject\prod\${APP_VERSION}\"
@sdesalas
Copy link
Author

sdesalas commented Jul 3, 2014

Useful for backup scripts that dont fall over when project structure hasnt been created yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment