Skip to content

Commit

Permalink
rclone dedupe
Browse files Browse the repository at this point in the history
  • Loading branch information
MrDoobPG authored and MrDoobPG committed Dec 29, 2019
1 parent f47a6b3 commit 1f3b09e
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 1 deletion.
47 changes: 46 additions & 1 deletion menu/interface/settings.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,50 @@ source /opt/plexguide/menu/functions/serverid.sh
source /opt/plexguide/menu/functions/nvidia.sh
source /opt/plexguide/menu/functions/uichange.sh

rcdupe() {
tee <<-EOF
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🚀 RClone dedupe
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
INFO AND NOTE
Interactively find duplicate files and delete/rename them.
Synopsis
By default dedupe interactively finds duplicate files and offers
to delete all but one or rename them to be different.
Only useful with Google Drive which can have duplicate file names.
In the first pass it will merge directories with the same name.
It will do this iteratively until all the identical directories have been merged.
The dedupe command will delete all but one of any identical
(same md5sum) files it finds without confirmation.
This means that for most duplicated files the dedupe command will
not be interactive.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
[ Y ] Deploy rclone dedupe weekly
[ N ] Remove rclone dedupe weekly
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
[ Z ] EXIT
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EOF

# Standby
read -p '↘️ Type Number | Press [ENTER]: ' typed </dev/tty

case $typed in
Y) ansible-playbok /opt/plexguide/menu/rclonededupe/dupedeploy.yml ;;
y) ansible-playbok /opt/plexguide/menu/rclonededupe/dupedeploy.yml ;;
N) ansible-playbok /opt/plexguide/menu/rclonededupe/duperemove.yml ;;
n) ansible-playbok /opt/plexguide/menu/rclonededupe/duperemove.yml ;;
z) setstart ;;
Z) setstart ;;
*) setstart ;;
esac
}
# Menu Interface
setstart() {
### executed parts
Expand Down Expand Up @@ -53,6 +96,7 @@ touch /var/plexguide/pgui.switch
[5] System & Network Auditor
[6] Server ID change : Change your ServerID
[7] NVIDIA Docker Role : NVIDIA Docker
[8] RCLONE DEDUPE
[99] TroubleShoot : PreInstaller
Expand All @@ -76,7 +120,8 @@ EOF
setstart ;;
5) bash /opt/plexguide/menu/functions/network.sh && clear && setstart ;;
6) setupnew && clear && setstart ;;
6) nvidia && clear && setstart ;;
7) nvidia && clear && setstart ;;
8) rcdupe ;;
###########################################################################
99) bash /opt/plexguide/menu/functions/tshoot.sh && clear && setstart ;;
z) exit ;;
Expand Down
53 changes: 53 additions & 0 deletions menu/rclonededupe/dupe.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/bash

test="/opt/appdata/plexguide/rclone.conf"
log="/var/plexguide"


if grep -q "gdrive:" $test ; then
rclone dedupe gdrive: \
--dedupe-mode largest \
--verbose=1 \
--fast-list \
--retries 3 \
--no-update-modtime \
--user-agent="gdrivedupe" \
--timeout=30m \
--config /opt/appdata/plexguide/rclone.conf >> $log/gduncrypt-dupe.log
fi

if grep -q "tdrive:" $test ; then
rclone dedupe tdrive: \
--dedupe-mode largest \
--verbose=1 \
--fast-list \
--retries 3 \
--no-update-modtime \
--user-agent="tdrivedupe" \
--timeout=30m \
--config /opt/appdata/plexguide/rclone.conf >> $log/dupe-tduncrypt.log
fi

if grep -q "gcrypt:" $test ; then
rclone dedupe gcrypt: \
--dedupe-mode largest \
--verbose=1 \
--fast-list \
--retries 3 \
--user-agent="grcyptspace" \
--no-update-modtime \
--timeout=30m \
--config /opt/appdata/plexguide/rclone.conf >> $log/dupe-gdcrypt.log
fi

if grep -q "tcrypt:" $test ; then
rclone dedupe tcrypt: \
--dedupe-mode largest \
--verbose=1 \
--fast-list \
--retries 3 \
--user-agent="tcryptdupe" \
--no-update-modtime \
--timeout=30m \
--config /opt/appdata/plexguide/rclone.conf >> $log/dupe-tdcrypt.log
fi
14 changes: 14 additions & 0 deletions menu/rclonededupe/dupedeploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
#
# Title: PGBlitz (Reference Title File)
# Authors: Admin9705, Deiteq, and many PGBlitz Contributors
# URL: https://pgblitz.com - http://github.pgblitz.com
# GNU: General Public License v3.0
################################################################################
---
- cron:
name: Weekly rclone dedupe running
special_time: 'weekly'
job: 'bash /opt/plexguide/menu/rclonededupe/dupe.sh >/dev/null 2>&1'
state: present
ignore_errors: yes
15 changes: 15 additions & 0 deletions menu/rclonededupe/duperemove.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
#
# Title: PGBlitz (Reference Title File)
# Authors: Admin9705, Deiteq, and many PGBlitz Contributors
# URL: https://pgblitz.com - http://github.pgblitz.com
# GNU: General Public License v3.0
################################################################################
---
- cron:
name: Weekly rclone dedupe running
special_time: 'weekly'
job: 'bash /opt/plexguide/menu/rclonededupe/dupe.sh >/dev/null 2>&1'
state: absent
ignore_errors: yes

0 comments on commit 1f3b09e

Please sign in to comment.