Skip to content

Instantly share code, notes, and snippets.

@jeremyd2019
Last active May 26, 2024 23:06
Show Gist options
  • Save jeremyd2019/4984ff0fa1f6fd8c99d7b8b244c52088 to your computer and use it in GitHub Desktop.
Save jeremyd2019/4984ff0fa1f6fd8c99d7b8b244c52088 to your computer and use it in GitHub Desktop.
Script to clean up files that msys2-runtime moved to recycle bin because they were in use
#!/bin/bash -e
shopt -s nullglob
root="$(cygpath -w /)"
root="$(cygpath -u "${root:0:2}")"
trash=("${root}/\$Recycle.Bin/S-1-"*/$'.\355\261\255'*)
if (( ${#trash[@]} )); then
ls -la "${trash[@]}"
read -r -p "Remove? (y/N) "
if [[ "${REPLY^^}" == "Y" ]]; then
rm -f "${trash[@]}"
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment