Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- directory="${1-$(pwd)}"
- if [ ! -d "$directory" ]
- then
- echo "No such directory: $directory" >&2
- exit 1
- fi
- declare -a fileset
- while IFS='' read -r f; do
- fileset+=("$f")
- done < <(svn status "$directory" | sed '/^?/!d;s/^? //')
- if [[ ! $fileset ]]
- then
- echo "There are no unversioned files to remove."
- exit 0
- fi
- echo
- echo "WARNING: You are about to remove the following files which have not been versioned in svn:"
- echo "--------"
- echo
- for f in "${fileset[@]}"
- do
- # echo "$f"
- echo "${f/#$(pwd)/.}"
- done
- echo
- read -p "Confirm? [Y/n]: " response
- echo
- case "$response" in
- y|Y|'')
- echo "Removing non-versioned files:"
- echo
- for f in "${fileset[@]}"
- do
- # rm -rfv "$f"
- rm -rfv "${f/#$(pwd)/.}"
- done
- ;;
- *)
- echo "Aborted."
- ;;
- esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement