-
Notifications
You must be signed in to change notification settings - Fork 31
/
gclone
477 lines (469 loc) · 21.3 KB
/
gclone
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
#!/usr/bin/env bash
#=============================================================
# https://github.com/xd003/clone
# File Name: clone
# Author: xd003
# Description: Clone bash script to be used for common fclone/gclone operations
# System Supported: Arch , Ubuntu/Debian , Fedora & Termux ( amd64 & arm64 )
#=============================================================
cecho() {
local code="\033["
case "$1" in
black | bk) color="${code}0;30m" ;;
red | r) color="${code}1;31m" ;;
green | g) color="${code}1;32m" ;;
yellow | y) color="${code}1;33m" ;;
blue | b) color="${code}1;34m" ;;
purple | p) color="${code}1;35m" ;;
cyan | c) color="${code}1;36m" ;;
gray | gr) color="${code}0;37m" ;;
*) local text="$1" ;;
esac
[ -z "$text" ] && local text="$color$2${code}0m"
echo -e "$text"
}
# Variable
conf="$HOME/easyclone/rc.conf"
ehome="$(echo $HOME)"
uflags="--fast-list --drive-server-side-across-configs --drive-acknowledge-abuse --drive-keep-revision-forever --stats=10s -vP --drive-use-trash=false --drive-stop-on-upload-limit --user-agent randomstringxyz --log-file $HOME/easyclone/log.txt"
jc="$(ls -l $HOME/easyclone/accounts | egrep -c '^-')"
rjc1="$(shuf -i 1-$jc -n 1)"
rjc2="$(shuf -i 1-$jc -n 1)"
# Functions
fsrc() {
: > $HOME/easyclone/log.txt
sed -i '/^team_drive/d' $conf
sed -i '/^root_folder_id/d' $conf
cecho b "[When you need to enter folder id/url , you can enter b to choose a folder id from your bookmark.txt]"
read -e -p "Enter the source folder id or url : " src
if [ "$src" == "b" ]; then
cat $HOME/easyclone/bookmark.txt | nl -w1 -s'• '
echo
read -e -p "Enter the number corresponding to the folder_id which you want to use : " NUM
src="$(cat $HOME/easyclone/bookmark.txt | awk 'NF>1{print $NF}' | sed "${NUM}q;d")"
else
src=$(echo $src | sed -E 's~.*[/=]([01A-Z][-_[:alnum:]]+)([?/].*|$)~\1~')
fi
case $src in
0*)
sed -i "4iteam_drive = $src" $conf
;;
1*)
sed -i "4iroot_folder_id = $src" $conf
;;
esac
sed -ri "5s/[[:digit:]]+.json/$rjc1.json/" $conf
}
fdst() {
read -e -p "Enter the destination folder id or url : " dst
if [ "$dst" == "b" ]; then
cat $HOME/easyclone/bookmark.txt | nl -w1 -s'• '
echo
read -e -p "Enter the number corresponding to the folder_id which you want to use : " NUM
dst="$(cat $HOME/easyclone/bookmark.txt | awk 'NF>1{print $NF}' | sed "${NUM}q;d")"
else
dst=$(echo $dst | sed -E 's~.*[/=]([01A-Z][-_[:alnum:]]+)([?/].*|$)~\1~')
fi
case $dst in
0*)
sed -i "11iteam_drive = $dst" $conf
;;
1*)
sed -i "11iroot_folder_id = $dst" $conf
;;
esac
sed -ri "12s/[[:digit:]]+.json/$rjc2.json/" $conf
}
while true; do
cat << EOF
┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋1) Copy
┋ (Copy files from source to dest, skipping already copied)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋2) Move
┋ (Move files from source to dest, skipping already moved)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋3) Sync
┋ (Make source and dest identical, modifying destination only)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋4) Dedupe
┋ (Find duplicate files and delete/rename them)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋5) Size
┋ (Return the total size and number of objects)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋6) Listing
┋ (List all the files and folders)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋7) NCDU
┋ (Explore directory with text based UI)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋8) Upload | Download
┋ (Move , Copy or Sync Local Folder to Drive OR Download files locally)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋9) Empty Trash
┋ (You need to have Manager Permission in TD)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋10) Delete Empty Folders
┋ (Delete all Empty Folders recursively)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋11) Check
┋ (Check if the files in the source and destination match)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋12) Delete
┋ (Delete a file or a folder along with its content)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋13) Quit
┋ (Exit the Script)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
EOF
echo
read -e -p "Enter your input : " opt
echo
case $opt in
1)
cecho y "Copy option has been selected"
fsrc
fdst
echo
cecho b "Do you want to use --ignore-existing flag for this process ?"
cecho b "[Only use it if your source/destination doesn't contain modification of any file overwritten with same name as even after having different size they will be considered equal and ignored]"
read -e -p "Enter Your Input [y/n] : " ig
case $ig in
[Yy]*)
gclone --config=$conf copy src: dst: $uflags --ignore-existing
;;
[Nn]*)
gclone --config=$conf copy src: dst: $uflags
;;
esac
;;
2)
cecho y "Move option has been selected"
fsrc
fdst
echo
cecho b "Do you want to use --ignore-existing flag for this process ?"
cecho b "[Only use it if your source/destination doesn't contain modification of any file overwritten with same name as even after having different size they will be considered equal and ignored]"
read -e -p "Enter Your Input [y/n] : " ig
case $ig in
[Yy]*)
gclone --config=$conf move src: dst: $uflags --delete-empty-src-dirs --ignore-existing
;;
[Nn]*)
gclone --config=$conf move src: dst: $uflags --delete-empty-src-dirs
;;
esac
;;
3)
cecho y "Sync option has been selected"
fsrc
fdst
echo
cecho b "Do you want to use --ignore-existing flag for this process ?"
cecho b "[Only use it if your source/destination doesn't contain modification of any file overwritten with same name as even after having different size they will be considered equal and ignored]"
read -e -p "Enter Your Input [y/n] : " ig
case $ig in
[Yy]*)
gclone --config=$conf sync src: dst: $uflags --ignore-existing
;;
[Nn]*)
gclone --config=$conf sync src: dst: $uflags
;;
esac
;;
4)
cecho y "Dedupe option has been selected"
cat << EOF
┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋1) Interactive
┋ (Use Dedupe Interactively)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋2) Skip
┋ (Removes identical files then skips anything left)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋3) First
┋ (Removes identical files then keeps the first one)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋4) Newest
┋ (Removes identical files then keeps the newest one)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋5) Oldest
┋ (removes identical files then keeps the oldest one)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋6) Largest
┋ (removes identical files then keeps the largest one)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋7) Smallest
┋ (removes identical files then keeps the smallest one)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋8) Rename
┋ (removes identical files then renames the rest to be different)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋9) Return to Main Menu
┋ (Restart the script from Main Menu)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
EOF
echo
read -e -p "Enter the Dedupe Operation Mode (1-9) : " dm
if [[ $dm -ne 9 ]]; then
fsrc
fi
case $dm in
1)
cecho b "Dedupe Interactive option has been selected"
gclone --config=$conf dedupe --dedupe-mode interactive src: --fast-list --verbose=2
;;
2)
cecho b "Dedupe Skip option has been selected"
gclone --config=$conf dedupe --dedupe-mode skip src: --fast-list --verbose=2
;;
3)
cecho b "Dedupe First option has been selected"
gclone --config=$conf dedupe --dedupe-mode first src: --fast-list --verbose=2
;;
4)
cecho b "Dedupe Newest option has been selected"
gclone --config=$conf dedupe --dedupe-mode newest src: --fast-list --verbose=2
;;
5)
cecho b "Dedupe Oldest option has been selected"
gclone --config=$conf dedupe --dedupe-mode oldest src: --fast-list --verbose=2
;;
6)
cecho b "Dedupe Largest option has been selected"
gclone --config=$conf dedupe --dedupe-mode largest src: --fast-list --verbose=2
;;
7)
cecho b "Dedupe Smallest option has been selected"
gclone --config=$conf dedupe --dedupe-mode smallest src: --fast-list --verbose=2
;;
8)
cecho b "Dedupe Rename option has been selected"
gclone --config=$conf dedupe --dedupe-mode rename src: --fast-list --verbose=2
;;
9)
continue
;;
esac
;;
5)
cecho y "Size option has been selected"
fsrc
gclone --config=$conf size src: --fast-list
;;
6)
cecho y "Listing option has been selected"
cat << EOF
┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋1) ls
┋ (List the objects in the path with size and path)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋2) lsd
┋ (List all directories/containers/buckets in the path)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋3) lsf
┋ (List directories and objects in remote:path formatted for parsing)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋4) lsjson
┋ (List directories and objects in the path in JSON format)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋5) lsl
┋ (List the objects in path with modification time, size and path)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋6) tree
┋ (List the contents of the remote in a tree like fashion)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋7) Return to Main Menu
┋ (Restart the script from Main Menu)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
EOF
echo
read -e -p "Choose the listing type : " lt
if [[ $lt -ne 7 ]]; then
fsrc
fi
case $lt in
1)
cecho b "Listing / ls option has been selected"
gclone --config=$conf ls src:
;;
2)
cecho b "Listing / lsd option has been selected"
gclone --config=$conf lsd src:
;;
3)
cecho b "Listing / lsf option has been selected"
gclone --config=$conf lsf src:
;;
4)
cecho b "Listing / lsjson option has been selected"
gclone --config=$conf lsjson src:
;;
5)
cecho b "Listing / lsl option has been selected"
gclone --config=$conf lsl src:
;;
6)
cecho b "Listing / tree option has been selected"
gclone --config=$conf tree src:
;;
7)
continue
;;
esac
;;
7)
cecho y "NCDU option has been selected"
fsrc
gclone --config=$conf ncdu src: --fast-list 2>/dev/null
;;
8)
cecho y "Upload | Download option has been selected"
cat << EOF
┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋1) Upload + Copy
┋ (Copy file/folder locally to drive, skipping already copied)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋2) Upload + Move
┋ (Move file/folder locally to drive, skipping already moved)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋3) Upload + Sync
┋ (Make local and drive file/folder identical, modifying drive only)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋4) Download
┋ (Download content locally from Google Drive)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋5) Return to Main Menu
┋ (Restart the script from Main Menu)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
EOF
echo
read -e -p "Choose the appropriate option : " upl
if [[ $upl -ne 4 ]] && [[ $upl -ne 5 ]] ; then
read -e -p "Enter the path of the folder which you want to upload : " src
src="$(eval echo "$src")"
: > $HOME/easyclone/log.txt && sed -i '/^team_drive/d' $conf && sed -i '/^root_folder_id/d' $conf && fdst
fi
if [ "$upl" == "4" ] ; then
fsrc
read -e -p "Enter the path where you want to download files locally : " dst
dst="$(eval echo "$dst")"
fi
case $upl in
1)
gclone --config=$conf copy "$src" dst: $uflags
;;
2)
gclone --config=$conf move "$src" dst: $uflags --delete-empty-src-dirs
;;
3)
gclone --config=$conf sync "$src" dst: $uflags
;;
4)
gclone --config=$conf copy src: "$dst" $uflags
;;
5)
continue
;;
esac
;;
9)
cecho y "Empty Trash option has been selected"
fsrc
gclone --config=$conf delete src: --drive-trashed-only=true --drive-use-trash=false --fast-list --verbose=2 --log-file $HOME/easyclone/log.txt
;;
10)
cecho y "Delete Empty folders option has been selected"
fsrc
gclone --config=$conf rmdirs src: --leave-root --fast-list --log-file $HOME/easyclone/log.txt
;;
11)
cecho y "Check option has been selected"
cat << EOF
┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋1) Compare only Size
┋ (MD5/SHA1 is not considered here. Use this for a quick check)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋2) Compare Size + MD5 / SHA1 Hash
┋ (Compares sizes and hashes and logs report of unmatched files. Very slow process)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋3) Compare after Downloading data locally
┋ (Download data from both the directories and Compare them on the fly. Use only if remote doesn't support hashes)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋4) Return to Main Menu
┋ (Restart the script from Main Menu)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
EOF
echo
read -e -p "Choose the Comparison Mode : " opt
if [[ $opt -ne 4 ]]; then
fsrc
fdst
fi
case $opt in
1)
cecho b "Check / Compare only size option has been selected"
gclone --config=$conf check src: dst: -P --drive-server-side-across-configs --fast-list --size-only
;;
2)
cecho b "Check / Compare size + MD5 option has been selected"
gclone --config=$conf check src: dst: -P --drive-server-side-across-configs --fast-list
;;
3)
cecho b "Check / Compare locally downloaded date option has been selected"
gclone --config=$conf check src: dst: -P --drive-server-side-across-configs --fast-list --download
;;
4)
continue
;;
esac
;;
12)
cecho y "Delete option has been selected"
cat << EOF
┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋1) Delete
┋ (Delete the contents of path)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋2) Deletefile
┋ (Delete a single file from path)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋3) Purge
┋ (Delete the path and its content)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
┋4) Return to Main Menu
┋ (Restart the script from Main Menu)
┋┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉
EOF
echo
read -e -p "Enter your input : " opt
if [[ $opt -ne 4 ]]; then
fsrc
fi
case $opt in
1)
cecho b "Delete / Default option has been selected"
gclone --config=$conf delete src: -vP --stats-one-line --stats=15s --fast-list --log-file $HOME/easyclone/log.txt
;;
2)
cecho b "Delete / Deletet option has been selected"
gclone --config=$conf deletefile src: -vP --stats-one-line --stats=15s --fast-list --log-file $HOME/easyclone/log.txt
;;
3)
cecho b "Delete / Purge option has been selected"
gclone --config=$conf purge src: -vP --stats-one-line --stats=15s --fast-list --log-file $HOME/easyclone/log.txt
;;
4)
continue
;;
esac
;;
13)
exit
;;
esac
if [[ "$?" ]]; then
break
fi
done