LoginSignup
1
3

More than 5 years have passed since last update.

自ディレクトリ以下から bin, obj ディレクトリを全て削除するスクリプト

Posted at

おそらく3億人の .NET プログラマが書いたであろうスクリプト、 PowerShell で書いてみました。

clean.ps1
$dirs = Get-ChildItem -Recurse * | ? { $_.PSIsContainer} | % { $_.FullName} `
 | grep -e bin$ -e obj$ 

foreach ($dir in $dirs) {
    # echo $dir
    rm -rf $dir
}

Mac でも動くぞ!

PowerShell Core を入れると、 macOS でも動きます。 Visual Studio for Mac と併せてどうぞ(Linux でも動くはz)。

#!/bin/sh

cd `dirname $0`
pwsh clean.ps1 

※実は、 Xamarin.Android のビルド出力には obj/Release/android/bin みたいなのが含まれることがあるので、完全に obj, bin を抹消するには clean.ps1 を2回実行します。

1
3
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3