Applescript to move all .mp4 & .m4v from dropbox

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

  1. macrumors newbie

    Joined:
    Sep 23, 2007
    #1
    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

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #2
    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 ...
     
  3. macrumors member

    Joined:
    Aug 28, 2008
    #3
    one liner in terminal

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

    Joined:
    Aug 9, 2009
    #4
    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).
     
  5. macrumors 68040

    Joined:
    Feb 2, 2008
    #5
    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

    Joined:
    Aug 28, 2008
    #6
    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