-
Notifications
You must be signed in to change notification settings - Fork 0
/
offload.sh
executable file
·89 lines (76 loc) · 2.08 KB
/
offload.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
echo " _____ _ _____ _ _ _ _ _ "
echo " | __ \ | |_ _| | | | | | (_) |"
echo " | | | | | | | | | | | | |_ _| |"
echo " | | | |_ | | | | | | | | __| | |"
echo " | |__| | |__| |_| |_ | |__| | |_| | |"
echo " |_____/ \____/|_____| \____/ \__|_|_|"
echo " "
if [[ $1 == "help" ]];
then
echo "Usage: $0 [path of destination]"
else
if [[ -d DCIM ]];
then
echo "DCIM found"
echo "Destination: $1"
echo -ne "[y/n]? : "; read choice
destination=""
if [[ $choice == "y" ]];
then
destination=$1
else
echo -ne "Enter destination: "
read destination
fi
mv_command=""
echo -ne "Command to use: enter for mv, write something else: "
read mv_command
if [[ $mv_command == "" ]];
then
mv_command="mv"
fi
for folder in DCIM/*
do
echo "Folder:"
echo $folder
if [[ $folder == "DCIM/PANORAMA" ]]
then
mkdir -p "$destination/$name/panoramas"
$mv_command $folder/* "$destination/panoramas/"
else
for i in $folder/*.JPG
do
echo $i
photo_date=$(exiftool -d "%Y-%m-%d" -DateTimeOriginal -S -s $i)
echo $photo_date
if [[ -d "$destination/$photo_date" ]];
then
mv $i "$destination/$photo_date/photos/"
else
mkdir "$destination/$photo_date"
mkdir "$destination/$photo_date/photos"
mkdir "$destination/$photo_date/videos"
mv $i "$destination/$photo_date/photos/"
fi
done
for i in $folder/*.MP4
do
video_date=$(date -d"$(mediainfo $i --Inform="Video;%Tagged_Date%")" +%Y-%m-%d)
if [[ -d "$destination/$video_date" ]];
then
mv $i "$destination/$video_date/videos/"
else
mkdir "$destination/$video_date"
mkdir "$destination/$video_date/photos"
mkdir "$destination/$video_date/videos"
mv $i "$destination/$video_date/videos/"
fi
done
echo "Transfer done"
fi
done
else
echo "Error: Run script inside SD card"
pwd
fi
fi