Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On Debian Squeeze, I'd like for ctorrent to automatically open in a screen session if a new torrent file is placed in a particular folder (/home/torrent). Is there an easy way to, in a script, watch for new files being added to a folder and react to this change?

share|improve this question
Just a though, but why not start a screen session and leave bittornado running in it. With the btlaunchmanycurses.bittornado you just point it at a directory. When new .torrent files are added, it starts automatically. – Zoredache Nov 4 '12 at 21:18
@Zoredache Though it's too specific to be useful to the rest of the community as an answer, I like this idea and ultimately have decided upon going with this solution. – Suchipi Nov 4 '12 at 22:03
up vote 2 down vote accepted

You should check out inotify-wait, that’s exactly what you need:

share|improve this answer

You can write a bash script with the combinations of "ls" and "find" command to determine if the folder has new torrent files. And then run the script periodically with cron.

Alternatively you can use rTorrent or Transmission-cli. Both has the built in feature to watch a directory for torrent files.

share|improve this answer

You may want to use incron, from the description:

incron is an "inotify cron" system. It works like the regular cron but is driven by filesystem events instead of time events.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .