March 28Mar 28 Hi all, I'm looking for ideas/suggestions here:I would like to be able to download a file into one folder, then have it automatically duplicate into two other folders. I would like for this process to be running continuously, and if possible notice the downloaded file rather quickly.Download into Folder A -- insert process or suggestion here, that will notice this file here and then automatically duplicate the file to Folder B and to Folder C.** If possible a huge preference would be to have the files hard-linked instead of copy. But not a requirement.Thank you for any suggestions! Edited April 1Apr 1 by shelfactor
April 1Apr 1 Author Solution For 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.