Here is another script to help clean up movie folders. Until recently, I preferred having all of my movies in the same directory. After switching to Plex Media Server, I soon realized that Plex downloads fanart and other related movie files. The issue is that all of these additional files were also in the main movie directory. The following script went through and created a sub-directory for each movie name and then the second half moved the files into their respective folder.
Bash: Clean Movie Folders
for i in `find . -maxdepth 1 -type f -printf ‘%f\n’ |sed “s/^\(.*\)\..*$/\1/”`; do mkdir $i; done
for i in `find . -maxdepth 1 -type f -printf ‘%f\n’ |sed “s/^\(.*\)\..*$/\1/”`; do mv $i* $i; done