2012-12-08 17:37:43 +01:00
|
|
|
@echo off
|
|
|
|
|
|
|
|
rem tools/unlink.bat
|
|
|
|
rem
|
2024-09-10 14:15:58 +02:00
|
|
|
rem SPDX-License-Identifier: Apache-2.0
|
|
|
|
rem
|
2021-02-18 13:48:10 +01:00
|
|
|
rem Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
rem contributor license agreements. See the NOTICE file distributed with
|
|
|
|
rem this work for additional information regarding copyright ownership. The
|
|
|
|
rem ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
rem "License"); you may not use this file except in compliance with the
|
|
|
|
rem License. You may obtain a copy of the License at
|
2012-12-08 17:37:43 +01:00
|
|
|
rem
|
2021-02-18 13:48:10 +01:00
|
|
|
rem http://www.apache.org/licenses/LICENSE-2.0
|
2012-12-08 17:37:43 +01:00
|
|
|
rem
|
2021-02-18 13:48:10 +01:00
|
|
|
rem Unless required by applicable law or agreed to in writing, software
|
|
|
|
rem distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
rem WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
rem License for the specific language governing permissions and limitations
|
|
|
|
rem under the License.
|
2012-12-08 17:37:43 +01:00
|
|
|
rem
|
|
|
|
|
|
|
|
rem Verify that arguments were provided
|
|
|
|
|
|
|
|
set link=%1
|
|
|
|
if "%link%"=="" goto :MissingArgument
|
|
|
|
|
|
|
|
rem Check if something already exists at the link path
|
|
|
|
|
|
|
|
if exist "%link%" goto :LinkExists
|
|
|
|
|
2014-02-07 16:52:09 +01:00
|
|
|
rem It is not an error if the link does not exist
|
|
|
|
rem echo %link% does not exist
|
|
|
|
rem goto :ShowUsage
|
|
|
|
|
|
|
|
goto :End
|
2012-12-08 17:37:43 +01:00
|
|
|
|
|
|
|
rem %link% make be a symbolic link or it may be a copied director (with
|
|
|
|
rem a .fakelnk file in it). It really does not matter which: We do the
|
|
|
|
rem same thing in either case
|
|
|
|
|
|
|
|
:LinkExists
|
|
|
|
|
|
|
|
rmdir /q /s %link%
|
|
|
|
if errorlevel 1 (
|
|
|
|
echo Failed to remove existing object at %link%
|
|
|
|
goto :ShowUsage
|
|
|
|
)
|
|
|
|
|
|
|
|
goto :End
|
|
|
|
|
|
|
|
:MissingArgument
|
|
|
|
|
|
|
|
echo Missing Argument
|
|
|
|
|
|
|
|
:ShowUsage
|
|
|
|
echo USAGE: %0 ^<link^>
|
|
|
|
echo Where:
|
2020-01-05 17:29:59 +01:00
|
|
|
echo ^<link^> is the linked (or copied) directory to be removed
|
2012-12-08 17:37:43 +01:00
|
|
|
|
|
|
|
:End
|