Last active
August 29, 2015 13:56
-
-
Save scorpp/9207503 to your computer and use it in GitHub Desktop.
Find all java files in current directory and move them in maven-correct directory with git
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -type f -name '*.java' | \ | |
while read f; do \ | |
target=$(grep '^package ' $f | sed -e 's/package \+//' -e 's/;$//' -e 's/\./\//g'); \ | |
newf="src/main/java/${target}/$(basename $f)"; \ | |
mkdir -p $(dirname $newf); \ | |
git mv $f $newf; \ | |
chmod 644 $newf; \ | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment