Copying only a certain file type, retaining directory structure

Discussion in 'macOS' started by uncleMonty, Mar 29, 2013.

  1. uncleMonty macrumors regular

    Joined:
    Jun 8, 2012
    #1
    I want to make space on an old MacBook we have. It's still running 10.4. Using Disk Inventory I see the biggest contribution to the contents of the HD is all the movies contained in the iPhoto library. I'd like to move these to an external HD. Is there a simple way to copy the iPhoto library to the HD, retaining all the folder/sub-folder hierarchy, but only including files with extension .mov or .mp4 or .mpg? And then is there a simple way to select all these files on the HD and delete them, once I'm sure they've been copied properly?
     
  2. balamw Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #2
    Personally, I'd do this all within iPhoto. Use iPhoto to create a clone of your library and then delete the movies from the library on your HDD within iPhoto.

    B
     
  3. uncleMonty thread starter macrumors regular

    Joined:
    Jun 8, 2012
    #3
    Thanks for your advice - can I use iPhoto to create the clone directly onto the HD? There is nowhere near enough room to do it on the HD then copy it.
     
  4. benwiggy macrumors 68020

    Joined:
    Jun 15, 2012
    #4
    This is of course the sort of thing that Unix shell scripting excels at.

    You may be able to find a script that does something similar -- or go and ask on a Unix shell forum if someone can supply the relevant code.

    I'm at the stage where I have to do a bit of research, read the man pages for each command, copy existing scripts and adapt them. It takes me a bit of time, but I'm gradually building up my own library of useful things. There are millions of example scripts out there, of course.
     
  5. uncleMonty thread starter macrumors regular

    Joined:
    Jun 8, 2012
    #5
    Or how about this: in the Finder, I drag the folder "iPhoto Library" over to the HD, and it copies the whole thing intact. If I do this, then delete the movie files from my MacBook to make up some room, would I be able to browse this backed-up version of the iPhoto library directly from the external drive, while in iPhoto?

    If so, how do I tell iPhoto to look at a different iPhoto Library folder than usual when it starts up?
     
  6. balamw Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #6
    Hold down Option when launching iPhoto.

    B
     
  7. uncleMonty thread starter macrumors regular

    Joined:
    Jun 8, 2012
    #7
    benwiggy: I agree, and I have often hacked up shell scripts to make life easier. In this case it would be incredibly easy: cp the library to the new destination, then rm -Rf (recursively, no confirmation dialogue) anything that doesn't have .mov, .MPG or .mp4 in the filename.

    But I'm always worried with this kind of library folder (the kind that looks as if it's part of the application package) that there's some kind of meta-information or structure that won't transfer using these straightforward unix commands, and I'll screw it up enough that the library I create will be unreadable.

    balamw: Wow, the things you learn. Thanks so much for this tip! Can all versions of iPhoto read libraries from all other versions of iPhoto?
     
  8. balamw Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #8
    I believe that they are all backwards compatible, i.e. any version of iPhoto will open a library built using an earlier version of iPhoto but will convert the library to the latest version when you open it.

    B
     

Share This Page