2011/5/30 Rony gnulinuxist@gmail.com:
find $HOME -name '*.mp3' -print0 | xargs -0 mv -t /music
and similarly for video etc.
I was just going to write that. I used
find . -name *.mp3 -exec mv '{}' Media/Music/ \ ;
There are three problems with this.
1. If there is a something.mp3 in your current working directory, then this will process precisely that file (and any other identically named files). It will not process *all* mp3 files. In my original, I had single-quoted *.mp3 for this reason.
2. Sometime in life, this find will descend into Media/Music and process the files there again - which are already moved. Wastage of CPU cycles. Which is why I had used a /music that is outside of $HOME.
3. find | xargs is superior to find -exec, due to the fact that the former is more efficient. See: http://blog.endpoint.com/2010/07/efficiency-of-find-exec-vs-find-xargs.html
Binand