-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathftpdownloader.sh
More file actions
96 lines (88 loc) · 2.05 KB
/
ftpdownloader.sh
File metadata and controls
96 lines (88 loc) · 2.05 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
93
94
95
96
#!/bin/bash
# Purpose: Download New File from FTP server
# Author: mabedini <abedini1984@yahoo.com>
# Note : FTP server anonymous log in Acctive.
# Last updated on : 2024-02-09
# -----------------------------------------------
# make Directory to save Files
echo " #####shell checking your needed Directori#####"
if test -d ./files
then
echo files directori is fine
else
echo " making directory files"
mkdir ./files
fi
if test -d ./dl
then
echo dl directori is fine
else
echo " making direcory download"
mkdir ./dl
fi
if test -d ./upload
then
echo upload directori is fine
else
echo " making directory Upload"
mkdir ./upload
fi
#Make File for Download history
echo " #####shell checking your needed Files#####"
DB1=first.ftp
DB2=list.ftp
DB3=diff.ftp
DB4=tmp
if test -e ./files/$DB1
then
echo $DB1 is fine
else
echo making file $DB1
touch ./files/$DB1
fi
if test -e ./files/$DB2
then
echo $DB2 is fine
else
echo making file $DB2
touch ./files/$DB2
fi
if test -e ./files/$DB3
then
echo $DB3 is fine
else
echo making file $DB3
touch ./files/$DB3
fi
if test -e ./files/$DB4
then
echo $DB4 is fine
else
echo making file $DB3
touch ./files/$DB4
fi
echo "########################################"
echo File and direcory Checking is fine
sleep 5
#FTP=ftp://ftp.spline.de/pub/OpenBSD/7.2/
#FTP=127.0.0.1/pub
echo ls | ftp -a 127.0.0.01 > ./files/$DB4
awk '{print $9}' ./files/$DB4 > ./files/$DB2
cat ./files/$DB2
cat ./files/$DB1
#awk '{print $9}' ./files/$DB4 > ./files/$DB1
if [ -s ./files/$DB1 ]
then
echo $DB1 is fine no need to add
else
cat ./files/$DB2 > ./files/$DB1
fi
#cat ./files/$DB1
grep -xvFf ./files/$DB1 ./files/$DB2 > ./files/$DB3
for i in `cat ./files/$DB3` ;
do
echo $i
wget -P ./dl ftp://127.0.01/$i
done
cat ./files/$DB2 > ./files/$DB1
echo > ./files/$DB2