-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAndr-DL-tool.sh
More file actions
executable file
·146 lines (121 loc) · 4.57 KB
/
Andr-DL-tool.sh
File metadata and controls
executable file
·146 lines (121 loc) · 4.57 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#!/bin/bash
##############################################################
# This is a simple script to help with the wireless download
# of photos from an Android device to a local machine, then
# with the option to secure copy these photos to a local
# server.
##############################################################
# Set Global Variables
_NewFile="Media$(date +%Y_%m_%d_%H%M%S)"
##############################################################
# Display logo
clear
cat jhart_shell_logo.txt
echo -e "\n"
echo "####################################################################"
echo "####################################################################"
echo -e "\n"
#############################################################
# Here we Create a time stamped file to store the photos from the android device
cd ~/Pictures
mkdir $_NewFile
cd $_NewFile
##############################################################
# Here we take the users android device IP address and download
# the photos and videos using the ftp connection then the script
# will move any movie files into a new Movies foler.
#set -e
echo "This script will pull your photos and movies from your android device. It will also move any movies to a new Movies folder inside your Pictures folder."
echo -e "\n"
echo "########################################################################"
echo "########################################################################"
while true; do
echo "Please enter your androids current IP Address."
read _IpAddr
echo "You entered your androids IP Address as "$_IpAddr""
echo "Is your IP address correct? y/n "
read yn
if [ "$yn" = "y" ];
then
echo "Now going to download your photos, videos, and albums from your android device to your local machines Pictures folder."
sleep 3
wget -r -l 3 ftp://"$_IpAddr":2211/DCIM/
cd ~/Pictures/"$_NewFile"/*/DCIM/
mkdir Movies
_MovieTitles="$( find . -iname "*.mp4" -print )"
mv "$_MovieTitles" Movies/
break
fi
done
##############################################################
cd ~/Pictures
##############################################################
# Here we ask the user if they have a local server that they want
# to copy their photos and videos onto from their local machine
while true; do
echo -e "\n"
echo "###################################################################"
echo "###################################################################"
echo -e "\n"
echo "Do you want to copy your photos and videos from you local machine to your local server? y/n "
read _Rspns
case $_Rspns in
[Yy]* ) while true; do
echo "Please enter your local server address (Example "username"@xxx.xxx.xxx:/path/to/local/server/share/folder/)"
read _SvrAddr
echo "You entered your local server address as "$_SvrAddr""
echo "Is your server address correct? y/n "
read _SvrRspns
if [ "$_SvrRspns" = "y" ];
then
echo "Now going to secure copy your photos and videos to your local server location."
sleep 3
scp -r "$_NewFile" "$_SvrAddr"
echo "All done."
break
fi
done
break;;
[Nn]* ) echo "All done."
break;;
* ) echo "Please answer with (y) for yes or (n) for no."
esac
done
while true; do
echo -e "\n"
echo "####################################################################"
echo "####################################################################"
echo "Do you want to remove photos and movies recently added in file "$_NewFile"? If you did not back up these files to a local server in the previous step you will probably want to answer NO. (WARNING... answering yes will remove all photos and movies in newly created "$_NewFile" from your local machine." y/n?
read _FinalRspns
case $_FinalRspns in
[Yy]* ) while true; do
echo "You have indicated that you want to remove all photos and movies in newly created "$_NewFile" from your local machine. If this is correct please type 'Yes, please!'. If not please type 'NO!'"
read _FinalRspnsTwo
if [ "$_FinalRspnsTwo" == "Yes, please!" ];
then
echo "Now going to remove "$_NewFile"."
sleep 3
cd ~/Pictures
rm -rf "$_NewFile"
echo "All done."
break
else
if [ "$_FinalRspnsTwo" == "NO!" ];
then
echo "All done."
break
fi
fi
done
break;;
[Nn]* ) echo "All done."
break;;
* ) echo "Please answer with (y) or (n) for no."
esac
done
##############################################################
# Done Message
echo "Your transfers are complete. Enjoy and Thank You! -Jhart"
sleep 3
#############################################################
exit