shelfactor
Members
-
Joined
-
Last visited
Solutions
-
shelfactor's post in [SOLVED] Ideas for Duplicated Files was marked as the answerFor anyone coming to this thread from a search, I ended up using User Scripts + INOTIFY to watch the folder and hardlink to others. I have the script set to run at startup continuously.
#!/bin/bash WATCH_DIR="[WATCH DIRECTORY]" DEST1="[DESTINATION FOLDER1]" DEST2="[DESTINATION FOLDER2]" echo "Starting hardlink watcher..." echo "Watching: $WATCH_DIR" inotifywait -m -r -e close_write,moved_to --format '%w%f' "$WATCH_DIR" | while read FILE do # Only process files (skip directories) [ -f "$FILE" ] || continue REL_PATH="${FILE#$WATCH_DIR/}" DEST1_PATH="$DEST1/$REL_PATH" DEST2_PATH="$DEST2/$REL_PATH" # Create destination directories if needed mkdir -p "$(dirname "$DEST1_PATH")" mkdir -p "$(dirname "$DEST2_PATH")" # Create hardlinks if they don’t already exist if [ ! -e "$DEST1_PATH" ]; then ln "$FILE" "$DEST1_PATH" echo "Linked to calibre: $REL_PATH" fi if [ ! -e "$DEST2_PATH" ]; then ln "$FILE" "$DEST2_PATH" echo "Linked to calibreweb: $REL_PATH" fi done