Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

aeronauticsrock

macrumors member
Original poster
Jan 30, 2010
83
0
Hi Everyone,

I'm in the process of ripping my DVD collection and want to automate the workflow of moving the .dvdmedia files and .m4v files from my desktop to alphabetical folders on an external HD.

I know how to do it in automater (very tedious and I'm sure the worst way) by finding .dvdmedia and .m4v files on the desktop, checking if the filename starts with an A, and then moving it to the A folder. The problem is that this would require me to set up 104 automator actions- 2 for each letter, and 1 each for .dvdmedia and .m4v.

So I am looking for the "better way". I am not extremely good with Applescript but I know some of the basics. For reference, the external hard drive structure looks like:

2TB External
/Movies
/DVD Rips​
/A​
/B​
.
.
.
/Full Movies​
/A​
/B​
.
.
.

Thanks in advance for any guidance!
 
I'm not an apple script person so I cant help you there, unfortunately, however I can point you at a retail product that I believe does what you want: Hazel

If you don't want to spend the money, I can offer ruby scripting advice instead
 
I would just use a simple bash script..

Code:
#!/bin/bash

## Guessing the paths..
dvd_rips="/Volumes/2TB\ External/Movies/DVD\ Rips"
full_movies="/Volumes/2TB\ External/Movies/Full\ Movies"

for i in $(ls ~/Desktop/|egrep '(.m4v|.dvdmedia)'); do
	dest_dir=$(echo "$i"|tr [:lower:] [:upper:]|cut -c1)
	if [ "$(echo "$i"|rev|cut -d'.' -f1|rev)" == "m4v" ]; then
		mv "~/Desktop/${i}" ${full_movies}/${dest_dir}/
		echo "moving "$i" to ${full_movies}/${dest_dir}/"
	elif [ "$(echo "$i"|rev|cut -d'.' -f1|rev)" == "dvdmedia" ]; then
		mv "~/Desktop/${i}" ${dvd_rips}/${dest_dir}/
		echo "moving "$i" to ${dvd_rips}/${dest_dir}/"
	fi
done
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.