-
Notifications
You must be signed in to change notification settings - Fork 7
/
import.sh
65 lines (51 loc) · 1019 Bytes
/
import.sh
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
## import source files.
APIKEY=$(cat /srv/etherpad-lite/APIKEY.txt)
createpad_url='http://127.0.0.1:9001/api/1/createPad'
function createpad {
f=$1
echo ".. adding $f"
#filepath=$(echo ${f:2} | sed 's|/|___|g')
curl -d "apikey=$APIKEY" --data-urlencode "padID=${f:2}" --data-urlencode "text=$(cat $f)" $createpad_url
echo ''
}
## cd $project_path
for f in $(find .)
do
# take action on each file. $f store current file name
if [ -e $f ]
then
## Process file depending on extension
if [[ $f == *.json ]]
then
createpad $f
fi
if [[ $f == *.md ]]
then
createpad $f
fi
if [[ $f == *.txt ]]
then
createpad $f
fi
if [[ $f == *.js ]]
then
createpad $f
fi
if [[ $f == *.rb ]]
then
createpad $f
fi
if [[ $f == *.html ]]
then
createpad $f
fi
if [[ $f == *.css ]]
then
createpad $f
fi
if [[ $f == *.php ]]
then
createpad $f
fi
fi
done