Move files into folders based on EXIF Creation Date

Hi all,
Being a novice with Applescript I have read what I can find on this forum, but are not able to find exactly what I'm looking for. I think that the posting "Using AppleScript to create folders and place files in them" is the closest I get to what I want but I want to create the folders based on EXIF creation date.
Let me explain.
I have a folder that contains thousands of jpg, mp4, mov and avi files; all created by different cameras. I want to bring some order to this and place files in folders based on year, month and date that the file was created (the photo taken or the video captured). This date is stored in the EXIF creation date.
     Take all files in folder A
      foreach file find the EXIF creation date
      move each file into directory tree (at same location is ok) where toplevel is YEAR, next directory level is named accoring to EXIF creation date as MMDDYY
      if no EXIF creation date can be found, fallback to creation date (file property?)
      if no good date is found, leave file alone in folder A for manual sorting; do not use modification date as this may have been altered
     this would create a structure as
     2002
            011602
                    File 1 taken Jan 16 2002
                    File 2 taken Jan 16 2002
            082002
                    File 1 taken Aug 20 2002
                    File 2 taken Aug 20 2002
      2003
             etc 
     2004
         |   etc
     2014
             010114
                    File 1 taken Jan 1 2014
etc etc

Well, technically that's correct, Frank, but the same could be said of much of AppleScript - the core functionality is limited, but there's a lot you can do.
For example, it's actually trivial to use Image Events get any given EXIF tag of an image:
set theFile to (choose file)
tell application "Image Events"
          set f to open theFile
          set cD to value of metadata tag "CreationDate" of f
  close f
end tell
Now, cD will have the value of the CreationDate tag (assuming it exists, of course - you'll need to wrap this in a try/end try statement). Once you have that it shouldn't be too hard to extract the date components, work out the target directory name and move the file.

Similar Messages

  • Cannot move files into folders on desktop

    Hi, I cannot move files into folders on desktop.  They won't go in when I grab them and drag them to a folder.

    Take these steps if the cursor changes from an arrow to a white "prohibited" symbol when you try to move an icon on the Desktop.
    Sometimes the problem may be solved just by logging out or restarting the computer. Try that first, if you haven't already done it. Otherwise, continue.
    Select the icon of your home folder (a house) in the sidebar of a Finder window and open it. The Desktop folder is one of the subfolders. Select it and open the Info window. In the General section of the window, the Kind will be either Folder  or something else, such as Anything.
    If the Kind is Folder, uncheck the box marked Locked. Close the Info window and test.
    If the Kind is not Folder, make sure the Locked box is not checked and that you have Read & Write privileges in the  Sharing & Permissions section. Then close the Info window and do as follows.
    Back up all data before continuing.
    Triple-click anywhere in the line below on this page to select it:
    xattr -d com.apple.FinderInfo Desktop
    Copy the selected text to the Clipboard by pressing the key combination command-C.
    Launch the built-in Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad and start typing the name.
    Paste into the Terminal window by pressing command-V. You should get a new line ending in a dollar sign ($). Quit Terminal.
    Relaunch the Finder.
    If the problem is now resolved, and if you use iPhoto, continue.
    Quit iPhoto if it's running. Launch it while holding down the option key. It will prompt you to select a library. Choose the one you want to use (not the Desktop folder.)

  • Can't move files into folders more than one time.

    I'm having a strange problem.  If I try and drag a file into a folder then it will allow me to do that, but only once.  If I try to drag another file into the same folder then it is locked.  I can drag it into a different folder, but the same thing happens, I can move a file into the new folder but not a 2nd file, but it is locked.  I have to restart to "unlock" these folders, but the same things happens over and over again.  I can move a single file into a folder, but after that it locks up and I have to restart.
    Any ideas why this is happening?  It only happens in bridge, I'm able to move files freely in Finder.
    Thanks!

    I can't find a permission setting that would only allow a single file to be moved to a folder
    Don't know if you already tried but use a check and repair permissions on your Mac using either Apple Disk Utility (applications / utilities) or a third party like Cocktail.
    If still the same happens restart bridge holding down option key and choose reset preferences.
    When the problem still exist please provide more details about OS and Bridge versions as well as computer specs.

  • Trying to create an Applecreate to rename files into folders based on filename

    I am trying to create an AppleScript that will take a file (a.b.c.txt forexample) and create a directory from the filename minusextensionand then move the file into that directory
    ie.a.b.c>a.b.c.txt
    I found this script from red_menace
    {input, parameters} -- create folders from file names and move
      set output to {} -- this will be a list of the moved files
      repeat with anItem in the input -- step through each item in the input
        set {theContainer, theName, theExtension} to (getTheNames from anItem)
        try
          set destination to (makeNewFolder for theName at theContainer)
          tell application "Finder"
            move anItem to destination
            set the end of the output to the result as alias -- success
          end tell
        on error errorMessage -- duplicate name, permissions, etc
          log errorMessage
          # handle errors if desired - just skip for now
        end try
      end repeat
      return the output -- pass on the results to following actions
    end run
    to getTheNames from someItem -- get a container, name, and extension from a file item
      tell application "System Events" to tell disk item (someItem as text)
        set theContainer to the path of the container
        set {theName, theExtension} to {name, name extension}
      end tell
      if theExtension is not "" then
        set theName to text 1 thru -((count theExtension) + 2) of theName -- just the name part
        set theExtension to "." & theExtension
      end if
      return {theContainer, theName, theExtension}
    end getTheNames
    to makeNewFolder for theChild at theParent -- make a new child folder at the parent location if it doesn't already exist
      set theParent to theParent as text
      if theParent begins with "/" then set theParent to theParent as POSIX file as text
      try
        return (theParent & theChild) as alias
      on error errorMessage -- no folder
        log errorMessage
        tell application "Finder" to make new folder at theParent with properties {name:theChild}
        return the result as alias
      end try
    end makeNewFolder
    But my problem with this script is that it does messes up if the file name includes the period, from my example, the listed script will make directorys a, b, and c instead of a.b.c

    You can use this Automator Workflow:
    for f in "$@"
    do
      d=${f%.*}
      if [ ! -d "$d" ]; then 
           mkdir "$d"
      fi
      mv "$f" "$d"
    done

  • Droplet to Rename and Move files into Folders

    Hello,
    I am a Graphic Designer and I am trying to optomize my workflow. I would like to be able to save out files with different prefixes in a folder then run a droplet on the folder that will create sub-folders and move the files to their respective folders based on their prefix. I would also like to remove the prefix from the filename after it is moved.
    Here is an example of what I am trying to achieve:
    So far I am able to Create the folders, and move the files, but I am stuck on removing the prefixes from the filename.
    property aFolder : "a"
    property bFolder : "b"
    property cFolder : "c"
    property dFolder : "d"
    property eFolder : "e"
    try
              tell application "Finder" to set theLocation to the selection as alias
              tell application "Finder" to set thePath to the selection as text
    on error
              tell application "Finder" to set theLocation to (folder of the front window as alias)
    end try
    tell application "Finder"
              if not (exists folder aFolder of theLocation) then
      make new folder at theLocation with properties {name:aFolder}
              end if
              if not (exists folder bFolder of theLocation) then
      make new folder at theLocation with properties {name:bFolder}
              end if
              if not (exists folder cFolder of theLocation) then
      make new folder at theLocation with properties {name:cFolder}
              end if
              if not (exists folder dFolder of theLocation) then
      make new folder at theLocation with properties {name:dFolder}
              end if
              if not (exists folder eFolder of theLocation) then
      make new folder at theLocation with properties {name:eFolder}
              end if
    end tell
    tell application "Finder"
              set this_list to every file of theLocation
              repeat with i in this_list
                        if (name of i) begins with "a" then
                                  move i to thePath & "a:"
                        else if (name of i) begins with "b" then
                                  move i to thePath & "b:"
                        else if (name of i) begins with "c" then
                                  move i to thePath & "c:"
                        else if (name of i) begins with "d" then
                                  move i to thePath & "d:"
                        else if (name of i) begins with "e" then
                                  move i to thePath & "e:"
                        end if
              end repeat
    end tell

    Here:
    property aFolder : "a"
    property bFolder : "b"
    property cFolder : "c"
    property dFolder : "d"
    property eFolder : "e"
    tell application "Finder"
    try
    set theLocation to the selection as alias
    on error
    set theLocation to (folder of the front window as alias)
    end try
    if not (exists folder aFolder of theLocation) then make new folder at theLocation with properties {name:aFolder}
    if not (exists folder bFolder of theLocation) then make new folder at theLocation with properties {name:bFolder}
    if not (exists folder cFolder of theLocation) then make new folder at theLocation with properties {name:cFolder}
    if not (exists folder dFolder of theLocation) then make new folder at theLocation with properties {name:dFolder} 
    if not (exists folder eFolder of theLocation) then make new folder at theLocation with properties {name:eFolder}
    set this_list to every file of theLocation
    repeat with i in this_list
    if (name of i) begins with "a" then
    move i to folder "a" of theLocation
    else if (name of i) begins with "b" then
    move i to folder "b" of theLocation
    else if (name of i) begins with "c" then
    move i to folder "c" of theLocation
    else if (name of i) begins with "d" then
    move i to folder "d" of theLocation
    else if (name of i) begins with "e" then
    move i to folder "e" of theLocation
    end if
    set name of (the result) to items 3 thru -1 of (get name of (the result)) as string
    end repeat
    end tell
    (98558)

  • How do I move files into folders in Pages? I can't seem to drag and drop anymore, except via my web browser in iCloud.

    Before the Yosemite update. I'm pretty sure I could just drag and drop documents in and out of folders. Now, I can't seem to do that, though the option still exists if i log into iCloud in my browser or even my iOS device. This seems odd to me. Am I missing something?

    Where did you recall doing this?
    Essentially all file movement is done in Finder, not Pages.
    Peter

  • I can not move my files into folders or trash

    I can not move my files into folders or trash,I continually have a message that says "working " on moving to a folder or trash,but it never gets done.
    I used to be able to drop and drag any files into any folders or into the trash.Please help.
    Thanks,
    iskaroll

    Please carefully read and use this article to help troubleshoot your Trash problem:
    http://www.thexlab.com/faqs/trash.html

  • Drag and drop files into folders in iPad reader? or iTunes?

    is it possible to drag and drop files into folders in iPad reader? or iTunes?  It is very clunkey to have to click each separate file to instruct it to move to the folder.  Better still, can I just sync an existing folder on my hard drive so the pdf's inside always remain up to date on my iPad?

    There is no way to drag and drop in Reader on an iPad.
    There is no way to sync PDFs in a folder on your hard drive to those inside of Reader.
    There are readers (which are NOT free) which let you do some of these things and have more capabilities. You might check out PDF Expert from Readdle which costs $9.99 US.

  • Problem importing MOV files into iPhoto

    I am getting an error when importing my iPhone mov files into iPhoto -- "The following file could not be imported. The file is in an unrecognized format". However the file plays ok with Quicktime.
    Can someone help me with this? Its a brand new mac and I have the latest iPhoto too.

    Option 1
    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Repair Database. If that doesn't help, then try again, this time using Rebuild Database.
    If that fails:
    Option 2
    Download iPhoto Library Manager and use its rebuild function. (In early versions of Library Manager it's the File -> Rebuild command. In later versions it's under the Library menu.)
    This will create an entirely new library. It will then copy (or try to) your photos and all the associated metadata and versions to this new Library, and arrange it as close as it can to what you had in the damaged Library. It does this based on information it finds in the iPhoto sharing mechanism - but that means that things not shared won't be there, so no slideshows, books or calendars, for instance - but it should get all your events, albums and keywords, faces and places back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one.  
    Regards
    TD

  • Cannot move files or folders on desktop   OSX 10.7.5  MacBook Air

    Cannot move files or folders on the desktop. This occurred suddenly - don't know what happened or how to undo this. Nothing on the desktop is moveable.
    MacBook Air   OSX   10.7.5

    Take these steps if the cursor changes from an arrow to a white "prohibited" symbol when you try to move an icon on the Desktop.
    Sometimes the problem may be solved just by logging out or restarting the computer. Try that first, if you haven't already done it. Otherwise, continue.
    Select the icon of your home folder (a house) in the sidebar of a Finder window and open it. The Desktop folder is one of the subfolders. Select it and open the Info window. In the General section of the window, the Kind will be either Folder  or something else, such as Anything.
    If the Kind is Folder, uncheck the box marked Locked. Close the Info window and test.
    If the Kind is not Folder, make sure the Locked box is not checked and that you have Read & Write privileges in the  Sharing & Permissions section. Then close the Info window and do as follows.
    Back up all data before continuing.
    Triple-click anywhere in the line below on this page to select it:
    xattr -d com.apple.FinderInfo Desktop
    Copy the selected text to the Clipboard by pressing the key combination command-C.
    Launch the built-in Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad and start typing the name.
    Paste into the Terminal window by pressing command-V. You should get a new line ending in a dollar sign ($). Quit Terminal.
    Relaunch the Finder.
    If the problem is now resolved, and if you use iPhoto, continue.
    Quit iPhoto if it's running. Launch it while holding down the option key. It will prompt you to select a library. Choose the one you want to use (not the Desktop folder.)

  • Can't drag files into folders in PDF portfolio

    I have created a PDF portfolio that contains primarily PDFs converted from e-mail messages, along with a few files from various Microsoft Office products. The portfolio has been added to over time, and now we have almost 100 files in the portfolio, so we'd like to organize these files into folders so it is easier to use.
    However, when I create a folder, I am not able to drag any files into it. I've tried all different types of files--PDFs, Word, PowerPoint--when I drag the file on top of the folder, I get the circle backslash symbol indicating the function is not allowed. I can't find any information about this in the Help files; every tutorial I've looked at indicates that I should be able to drag and drop files wherever I like, but doesn't mention what to do if I can't.
    I'm using Acrobat Pro X on Windows XP with Service Pack 3.
    Any suggestions about why this might be happening and how to fix it would be greatly appreciated! I really don't want to have to recreate the whole thing, but it's not going to be very useful if we continue adding unorganized files.
    Thanks,
    Lisa

    I tried a different layout (I had a custom layout set up; I switched to the standard Grid), and I still can't drag and drop.
    I just now created a new portfolio with a few of the same files, and I was able to drag the files into a folder I created.
    Yes, the original portfolio was created in Acrobat 9.
    Thanks,
    Lisa

  • I want to consolidate all my songs bought under 2-3 different user ids and passwords into one so I can move them into folders and organize my music.  How?   and I do not have any of the old id's or passwords.

    I have an older iPod one of the first touch screens.  I bought music under more than one apple id and password.  I got a Macbook last October and I just upgraded my old 3G phone to the new iPhone 5 (16 GB).  All my music is on these devices but I cannot organize it. I tried to move songs into folders on my laptop but they would not go into the folder.  I clicked on them and moved them by holding down the mouse.  I think it is because they are from different accounts.  Or am I moving them incorrectly?  I have already created most of the folders like for Christmas music and workout.  I just want to be able to manage all this.
    I am technologically challenged so if you explain something you cannot skip a step.  I am not even sure I picked the correct operating system below.
    Thanks,
    junebug12

    Purchases of multple Apple ID accounts cannot be merged as noted here >  Frequently asked questions about Apple ID

  • Can't import mov files into Final Cut Pro

    I can't seem to import some .mov files into FCP.  The codecs showing in "info" for the files are DV/DVCPRO - NTSC, Linear PCM, Timecode.  I have other files which I can import into FCP and they show the exact same codecs in their info page.  I have no trouble opening either in Quicktime.

    What is the origin of these files?  You may want to use QT or Compressor to re-encode them to the same codec.  Possbily they are very old QT versions.  But yes, where did they originate from?

  • Cannot import a .mov file into the library

    I am trying to import a .mov file into my library so I can
    create a .fla file. Every time I try to import it into the library
    using the import wizard, it starts the importing process and always
    quits not quite two minutes into the process. It then returns me to
    the front page of the import wizard. I have done this before with
    absolutely no problems.
    The one thing that I am wondering about is the size of this
    particular .mov file. It is 377MB. Do you think this may be part of
    my problem? Thank you in advance for anyone's input or
    suggestions!

    Jeremy Williams wrote:
    > I am trying to import a .mov file into my library so I
    can create a .fla file.
    > Every time I try to import it into the library using the
    import wizard, it
    > starts the importing process and always quits not quite
    two minutes into the
    > process. It then returns me to the front page of the
    import wizard. I have
    > done this before with absolutely no problems.
    >
    > The one thing that I am wondering about is the size of
    this particular .mov
    > file. It is 377MB. Do you think this may be part of my
    problem? Thank you in
    > advance for anyone's input or suggestions!
    I would consider 10mb to be too big for a flash file. Even if
    it was CD
    I would load it dynamically to avoid performance problem.
    377mb is out of the question way beyond flash ability to
    maintain stable
    performance, not just the final output but the IDE itself.
    Best Regards
    Urami
    <urami>
    If you want to mail me - DO NOT LAUGH AT MY ADDRESS
    </urami>

  • Can`t movies files into iTunes

    Hi,
    I am trying to move movies files into the iTunes library by dragging them and without success.
    I have tried to add the files with the file menu with the same results.
    Using iTunes 10.5
    Can anyone help me with this?
    thanks,
    Amnon

    Itunes only accepts MP4, M4V and MOV formats.  You will have to get a third party Video converter to convert AVI to Apple format.

Maybe you are looking for