move directories

on

I wanted to differentiate my movies into ones playable on dlna aware devices and others. ie my avi’s and mkv’s and mp4’s are ok. but files with reside into folders named video_ts need to be excluded.

So how to mv all dir’s (in from current dir) where an avi exists into the dlna folder:

find . -iname ‘*.avi’ | cut -d ‘/’ -f2 | sort | uniq | xargs -I {} mv -i {} /mnt/usb1/dlna/

(run this command again for mkv’s and mp4’s and move the folders where a video_ts exists into non_dlna).