ローカル環境の特定ディレクトリ(デフォルトは ~/Desktop と ~/Downloads)内で、git管理されていないファイルやフォルダ(untracked files)を一括削除するスクリプトです。
不要な一時ファイルやダウンロードファイルの整理、クリーンアップに活用できます。
-
スクリプトを配置します (場所は任意で、どこにおいても動作します)
cd ~/practice/script git clone git@github.com:yasuke-kuroda-diezon/script__cleanup_local_files.git
-
~/Desktopと~/Downloadsに git リポジトリを作成します(初回のみ)cd ~/Desktop git init cd ~/Downloads git init
-
スクリプトに実行権限を付与します
chmod +x ~/practice/script/script__cleanup_local_files/index.sh
以下のコマンドで実行できます。
cd ~
./practice/script/script__cleanup_local_files/index.sh
- 各ディレクトリに
.gitディレクトリが必要です。 rmコマンドを実行するのは~/Desktop/ディレクトリを誤って削除する事故が怖いので、git cleanコマンドを利用して安全に削除する方針としました。