Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old May 30, 2013, 11:42 PM   #1
dglenn9000
macrumors newbie
 
Join Date: Sep 2007
Applescript to move all .mp4 & .m4v from dropbox

I am looking for an Applescript to move all .mp4 & .m4v from my dropbox folder to my itunes media folder. Any suggestions?
dglenn9000 is offline   0 Reply With Quote
Old May 31, 2013, 12:59 PM   #2
kryten2
macrumors 6502a
 
Join Date: Mar 2012
Location: 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 ...
__________________
Space Corps Directive 34124

Last edited by kryten2; Jun 2, 2013 at 08:18 AM.
kryten2 is offline   0 Reply With Quote
Old Jun 1, 2013, 04:24 PM   #3
sero
macrumors member
 
Join Date: Aug 2008
one liner in terminal

Code:
for i in $(find ~/Dropbox -name "*.mp4"); do mv $i itunes_folder; done
sero is offline   0 Reply With Quote
Old Jun 1, 2013, 04:44 PM   #4
chown33
macrumors 603
 
Join Date: Aug 2009
Quote:
Originally Posted by sero View Post
one liner in terminal

Code:
for i in $(find ~/Dropbox -name "*.mp4"); 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).
chown33 is offline   0 Reply With Quote
Old Jun 1, 2013, 05:41 PM   #5
subsonix
macrumors 68030
 
Join Date: Feb 2008
Quote:
Originally Posted by sero View Post
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.
subsonix is offline   0 Reply With Quote
Old Jun 3, 2013, 12:35 AM   #6
sero
macrumors member
 
Join Date: Aug 2008
Quote:
Originally Posted by chown33 View Post
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.
sero is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 11:10 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC