Created
July 5, 2019 07:31
-
-
Save gullz/31d93eeafa78a08e80bff4c3f4df95da to your computer and use it in GitHub Desktop.
Add directories in to git repo one directory at a time.
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
#! /bin/bash | |
navigateDir() | |
{ | |
files=`ls` | |
for dir in $files | |
do | |
checkDir $dir | |
done | |
} | |
checkDir() | |
{ | |
dir=$1 | |
if [ $dir == "." ] | |
then | |
return | |
fi | |
if [ $dir == ".." ] | |
then | |
return | |
fi | |
cd $dir > /dev/null 2>&1 | |
result=$? | |
curDir=`pwd` | |
if [ $result -eq 0 ] | |
then | |
cd .. | |
mv $dir ../aosp | |
result=$? | |
else | |
return | |
fi | |
if [ $result -eq 0 ] | |
then | |
cd ../aosp | |
git add . | |
git commit -m "adding $dir" | |
git push | |
else | |
echo commit failed. | |
exit 127 | |
fi | |
cd - | |
} | |
navigateDir |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment