Need some help to figure out how to watch a folder for new files and clone it into another location reddit / selfhosted ---------------------------------------------------------------------- homelabfanatix · 2023-10-06 04:02 Basically have hdd1 with some files downloading from YT with ytdl material w/o meta or img. I need to either have ytdl material download into 2 diff locations at the same time or find something that can watch that folder and move over new files only to a 2nd hdd. This 2nd location is just a temp location as picard will scan and move the file to another folder on the 2nd hdd. My end goal is to be able to just have a folder with the mp3 file only so that it can be downloaded to a phone. The 2nd hdd is where the media with meta will be stored for navidrome. Any suggestions? Open to new solutions also...thanks! ---------------------------------------------------------------------- thekrautboy · 2023-10-06 04:47 SyncThing ---------------------------------------------------------------------- homelabfanatix · 2023-10-06 04:57 Can you do it between 2 hdd connected to same device? I thought syncthing was for 2 different devices. ---------------------------------------------------------------------- xkcd__386 · 2023-10-06 05:53 no you can't (on linux I have fooled it by running it in 2 different *userids*, but that's not a great solution) you could try `unison` or `rclone bisync` ---------------------------------------------------------------------- DecideUK · 2023-10-06 06:04 How are you automating ytdl? Can you utilise the --exec CMD option to run a script to copy files after download has finished? ---------------------------------------------------------------------- Darkchamber292 · 2023-10-06 06:17 If you are running docker you could do this by having 2 instances in 2 separate containers ---------------------------------------------------------------------- homelabfanatix · 2023-10-06 06:31 I was thinking about trying that, but wasn't sure if it'll work. I'll give this a try, since it'll he quick. ---------------------------------------------------------------------- homelabfanatix · 2023-10-06 06:33 Someone suggested 2nd docker container, which I'm going to try. If I can't get it to work, I'll definitely look into these options also. Thank you. ---------------------------------------------------------------------- homelabfanatix · 2023-10-06 06:37 This is something I haven't really explored too much and is like a last resort. I was thinking maybe setting up a cron job for it, but went down a bottomless hole with it. I tried setting up nextcloud but had major issues with the cron running. Ended up switching to file browser instead. ---------------------------------------------------------------------- iavael · 2023-10-06 14:52 If you need just one-way copy, then try lsyncd. It watches directories with inotify api and calls good old rsync if any changes are detected. ---------------------------------------------------------------------- homelabfanatix · 2023-10-06 14:57 Thanks for the suggestion. I'll look into this also. This def sounds like what I'm looking for. ---------------------------------------------------------------------- lorax-06 · 2023-10-06 16:12 I've done this before with incrontab ([https://linux.die.net/man/5/inc rontab](https://linux.die.net/man/5/incrontab)) to trigger a bash script to take actions when a new file is added. In my case I wanted new jpg files to be emailed, but you could setup multiple rsync jobs in that bash file. ---------------------------------------------------------------------- xkcd__386 · 2023-10-07 17:00 seems you can; see updates to my previous reply ---------------------------------------------------------------------- homelabfanatix · 2023-10-07 19:37 I'm going to have to attempt it again. I tried with 2 diff docker containers and couldn't get it to work. Looked into the other options and had some issues configuring them. Installed n8n and got it setup to listen to file changes on the folder, works, but just need to figure out how to setup the execute command node properly.