-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish.sh
executable file
·47 lines (40 loc) · 966 Bytes
/
publish.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
#!/bin/bash
HOST="ftp.zachkirsch.com"
USER="zachkirsch"
LCD="~/Documents/Developer/my_site"
RCD="/public_html"
#DELETE="--delete"
FAIL_EXIT="set cmd:fail-exit yes;"
# ---------------------------------- #
# ---------------------------------- #
# ---------------------------------- #
# Read Password
echo -n "Password: "
read -s PASS
echo
FTPURL="ftp://$USER:$PASS@$HOST"
# check if mkdir required
echo 'Checking if directory needs to be created on server...'
checkfolder=$(lftp -c "open -u $USER,$PASS $FTPURL; ls $RCD")
if [ "$checkfolder" == "" ];
then
MKDIR="mkdir $RCD;"
echo " Directory created"
else
echo " Directory already exists"
fi
echo 'Uploading modified files...'
lftp -c "
$FAIL_EXIT
open '$FTPURL';
lcd $LCD;
$MKDIR
cd $RCD;
mirror --reverse \
$DELETE \
--verbose \
--exclude-glob .git/ \
--exclude-glob .DS_Store \
--exclude-glob *.sh \
--exclude-glob .* \
--exclude-glob unused/"