delete duplicate files as well
This commit is contained in:
parent
04979e25f6
commit
3407dde776
@ -34,6 +34,10 @@ find_or_create_directory_for_target() {
|
|||||||
|
|
||||||
# Function to move files based on source keywords
|
# Function to move files based on source keywords
|
||||||
move_files() {
|
move_files() {
|
||||||
|
# Delete duplicate files using fdupes
|
||||||
|
echo "Removing duplicate files in $WATCHED_DIR..."
|
||||||
|
fdupes -r -N --delete "$WATCHED_DIR"
|
||||||
|
|
||||||
for FILE in "$WATCHED_DIR"/*.{epub,pdf,mobi,txt}; do
|
for FILE in "$WATCHED_DIR"/*.{epub,pdf,mobi,txt}; do
|
||||||
if [[ -f "$FILE" ]]; then
|
if [[ -f "$FILE" ]]; then
|
||||||
FILENAME=$(basename "$FILE")
|
FILENAME=$(basename "$FILE")
|
||||||
@ -54,9 +58,9 @@ move_files() {
|
|||||||
move_files
|
move_files
|
||||||
|
|
||||||
# Monitor for new or modified files and then sort them
|
# Monitor for new or modified files and then sort them
|
||||||
while inotifywait -e create -e moved_to -e modify "$WATCHED_DIR"; do
|
while inotifywait -r -e create -e moved_to -e modify "$WATCHED_DIR"; do
|
||||||
move_files
|
move_files
|
||||||
fdupes -r -N --delete .
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
shopt -u nocasematch
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user