Skip to content

Instantly share code, notes, and snippets.

@fgdrf
Created October 17, 2013 22:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fgdrf/b2a3bec327a4e7affab3 to your computer and use it in GitHub Desktop.
Save fgdrf/b2a3bec327a4e7affab3 to your computer and use it in GitHub Desktop.
change package structure with git mv
function change_java_packages
{
java_files=`find $1 -name "*.java" -type f -print`
created_folders=0
for jf in $java_files
do
path_to=`echo $jf | awk -F'net\/refractions\/udig\/' '{print $1}'`
within_path=`echo $jf | awk -F'net\/refractions\/udig\/' '{print $2}'`
if [ "$path_to" != "" ]; then
echo $path_to
if [ "$created_folders" = "0" ]; then
if [ ! -d "$path_to/org" ]; then
mkdir -p "$path_to/org"
fi
if [ ! -d "$path_to/org/locationtech" ]; then
mkdir -p "$path_to/org/locationtech"
fi
if [ ! -d "$path_to/org/locationtech/udig" ]; then
echo "mv udig folder to $path_to/org/locationtech"
git mv "$path_to/net/refractions/udig" "$path_to/org/locationtech/udig"
fi
created_folders=1
fi
fi
done
}
plugin_list=`find $c_path/plugins -d 1 -type d -print`
for plugin in $plugin_list
do
change_java_packages "$plugin" "$search_folder"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment