With an inotifywait script, and they'll be automatically moved to wherever you want on creation.
Code:
#!/bin/bash
MUSIC="/path/to/music"
VIDEO="/path/to/video"
PICS="/path/to/images"
moveIt() {
while [[ `lsof %f > /dev/null 2>&1` ]]; do
sleep 5 #File might be downloading, leave it alone for now
done
#hands off my file, im moving it
mv "$1" "$2"
}
inotifywait -qm --event CREATE --format %f ~/Desktop | while read file; do
case ${file:(-3)} in
"mp3") moveIt "$filei" "$MUSIC" ;;
"jpg"|"png") moveIt "$file" "$PICS" ;;
"avi"|"ogm"|"mkv") moveIt "$file" "$VIDEO" ;;
esac
done
Alter the declarations at the top to your liking, as well as the extensions I'm capturing in the case statement. Throw this into a script file, `chmod +x script.sh` and execute it as `./script.sh &`
P.S. You might need to install the inotify-tools package. I don't know offhand if Ubuntu comes prepackaged with it.
Bookmarks