1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

Applescript to move all .mp4 & .m4v from dropbox

Discussion in 'Mac Programming' started by dglenn9000, May 30, 2013.

  1. macrumors newbie

    I am looking for an Applescript to move all .mp4 & .m4v from my dropbox folder to my itunes media folder. Any suggestions?
  2. kryten2, May 31, 2013
    Last edited: Jun 2, 2013

    macrumors 6502a

    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.

    mdfind -0 -onlyin ~/Dropbox/ "(kMDItemFSName = "*.mp4" || kMDItemFSName = "*.m4v")" | xargs -0 ...
  3. macrumors member

    one liner in terminal

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

    The red-hilited part can be replaced with:
    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).
  5. macrumors 68040

    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.
  6. macrumors member

    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.

Share This Page