unlink.bat 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. @echo off
  2. rem tools/unlink.bat
  3. rem
  4. rem Licensed to the Apache Software Foundation (ASF) under one or more
  5. rem contributor license agreements. See the NOTICE file distributed with
  6. rem this work for additional information regarding copyright ownership. The
  7. rem ASF licenses this file to you under the Apache License, Version 2.0 (the
  8. rem "License"); you may not use this file except in compliance with the
  9. rem License. You may obtain a copy of the License at
  10. rem
  11. rem http://www.apache.org/licenses/LICENSE-2.0
  12. rem
  13. rem Unless required by applicable law or agreed to in writing, software
  14. rem distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  15. rem WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  16. rem License for the specific language governing permissions and limitations
  17. rem under the License.
  18. rem
  19. rem Verify that arguments were provided
  20. set link=%1
  21. if "%link%"=="" goto :MissingArgument
  22. rem Check if something already exists at the link path
  23. if exist "%link%" goto :LinkExists
  24. rem It is not an error if the link does not exist
  25. rem echo %link% does not exist
  26. rem goto :ShowUsage
  27. goto :End
  28. rem %link% make be a symbolic link or it may be a copied director (with
  29. rem a .fakelnk file in it). It really does not matter which: We do the
  30. rem same thing in either case
  31. :LinkExists
  32. rmdir /q /s %link%
  33. if errorlevel 1 (
  34. echo Failed to remove existing object at %link%
  35. goto :ShowUsage
  36. )
  37. goto :End
  38. :MissingArgument
  39. echo Missing Argument
  40. :ShowUsage
  41. echo USAGE: %0 ^<link^>
  42. echo Where:
  43. echo ^<link^> is the linked (or copied) directory to be removed
  44. :End