-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit_change_folder.sh
More file actions
executable file
·94 lines (79 loc) · 1.49 KB
/
Copy pathgit_change_folder.sh
File metadata and controls
executable file
·94 lines (79 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/bash
#STOREIFS=$IFS
function clone ()
{
echo "Clonning... $@"
sleep 1
git clone $1
#split_name_ncd $1
}
function split_name_ncd ()
{
#IFS='/.' # Intentional Field Separator
link="$1"
linknoslash=${link##*/}
#echo $linknoslash
dir=${linknoslash%.*}
echo $dir
cd $dir"/"
}
function rename ()
{
echo "rename"
declare -a pythonolddirs=("Python/" "Python3/" "Python2/")
declare -a others=("C/" "C#/" "NodeJS/" "CPP/" "JS/" "Swift/")
pwd
sleep 1
# ls on directories
for d in */;
do
echo "$d"
# see if d is in our directories array
case "${pythonolddirs[@]}" in *"$d"*)
echo "found"
sleep .5
echo "${pythonolddirs[@]}"
#mv "$d" "py/" ;;
git mv "$d" "py/" ;;
*) echo "--" ;;
esac
case "${others[@]}" in *"$d"*)
echo "found"
sleep .5
#mv "$d" `echo "$d" | tr 'A-Z' 'a-z'` ;;
git mv "$d" tmp
git mv tmp `echo "$d" | tr 'A-Z' 'a-z'`;;
*) echo "not found" ;;
esac
done
# exit 0
add_changes
cd ../
}
function add_changes ()
{
git add --all
git commit -m "Rename"
git push -u origin master
sleep 2
}
mkdir clones; mv gitlinks.txt clones/; cd clones; # make a new dir and go to it
# echo "Enter file (ex: file.txt): "
# read file
# if [ -z file ] # if file is empty
# then
# echo "I need the file to continue."
# exit 0
# fi
# loop thr ough each link in file
while read link;
do
printf "link %s\n" $link
clone $link
split_name_ncd $link
rename
#echo $link
# IFS=$STOREIFS
# unset IFS
#exit 0
done <gitlinks.txt