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

dglenn9000

macrumors member
Original poster
Sep 23, 2007
41
1
I am looking for an Applescript to move all .mp4 & .m4v from my dropbox folder to my itunes media folder. Any suggestions?
 

kryten2

macrumors 65816
Mar 17, 2012
1,114
99
Belgium
I would suggest you take a look at Automator to do this.

Edit : If dropbox folder is on indexed drive then mdfind is fast. But like subsonix said if you want iTunes to be aware of them you need to import them.

Code:
mdfind -0 -onlyin ~/Dropbox/ "(kMDItemFSName = "*.mp4" || kMDItemFSName = "*.m4v")" | xargs -0 ...
 
Last edited:

sero

macrumors member
Aug 28, 2008
91
14
one liner in terminal

Code:
for i in $(find ~/Dropbox -name "*.mp4"); do mv $i itunes_folder; done
 

chown33

Moderator
Staff member
Aug 9, 2009
10,731
8,407
A sea of green
one liner in terminal

Code:
[COLOR="Red"]for i in $(find ~/Dropbox -name "*.mp4")[/COLOR]; do mv $i itunes_folder; done

The red-hilited part can be replaced with:
Code:
for i in ~/Dropbox/*.mp4
Shell pattern-matching (globbing) suffices.

FWIW, the posted code won't work if there are spaces embedded in any filename. The problem exists for both approachs ('find' or globbing).
 

subsonix

macrumors 68040
Feb 2, 2008
3,551
79
one liner in terminal

Code:
for i in $(find ~/Dropbox -name "*.mp4"); do mv $i itunes_folder; done

I don't think it's enough to just move the files, if you want iTunes to be aware of them you need to import them. There is an "import to iTunes" action available in Automator though, and it's also available by default in the context menu on OS X if you select a media file.
 

sero

macrumors member
Aug 28, 2008
91
14
The red-hilited part can be replaced with:
Code:
for i in ~/Dropbox/*.mp4

I was assuming the files are not all in the top level dir, otherwise this would be easy enough in finder. But the OP didn't really specify.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.