I have a video encoding script that I would like to run as soon as a file is moved into a specific directory.
If I use something like inotify, how do I ensure that the file isn't encoded until it is done moving?
I've considered doing something like:

Copy (rsync) file into a temporary directory.
Once finished, move (simple 'mv') into the encode directory.
Have my script monitor the encode directory.

However, how do I get step #2 to work properly and only run once #1 is complete?
I am using Ubuntu Server 11.10 and I'd like to use bash, but I could be persuaded to use Python if that'd simplify issues.
I am not "downloading" files into this directory, per se; rather I will be using rsync the vast majority of the time.
Additionally, this Ubuntu Server is running on a VM.
I have my main file storage mounted via NFS from a FreeBSD server.
One technique I use works with FTP. You issue a command to the FTP server to transfer the file to an auxiliary directory. Once the command completes, you send a second command to the server, this time telling it to rename the file from from the aux directory to the final destination directory.If you're using inotify or polling the directory, the filename won't appear until the rename has completed, thus, you're guaranteed that the file is complete.
I'm not familar with rsync so I don't know if it has a similar rename capability.
Move file to another directory once it is done transferring