How do I move some files from some folders?

Discussion in 'macOS' started by Phil Lee, Feb 2, 2009.

  1. Phil Lee macrumors 6502

    Joined:
    Mar 19, 2008
    Location:
    Manchester, UK
    #1
    I use Lightroom 2 to catalog my photos. I am in the habit of shooting in RAW+JPG mode which means when I download my photos there is both a .NEF and a .JPG file for each photo. Having done this for several years on a PC, I now want to use iPhoto to view the jpgs and keep with Lightroom for the nefs. I therefore want to move the .JPG files from /Photography/RAW/<Year>/<Month>/<Day> to /Photography/JPG/<Year>/<Month>/<Day>.

    So far the only way I've worked out is to copy the entire folder structure then use Spotlight to find the nefs within the new folder structure and delete them. Is there a better way to do this?
     
  2. sidewinder macrumors 68020

    sidewinder

    Joined:
    Dec 10, 2008
    Location:
    Northern California
    #2
    The best way to do this is from the Terminal command line. Get to the Photography directory using the "cd" command. My example below is just an example. You need to get to the actual "Photography" directory. Here is what you do:

    Code:
    1$ cd /Users/you/Photography
    2$ cp -R RAW JPG
    3$ cd JPG
    4$ find . -name "*.nef" -print|xargs rm
    5$ cd ../RAW
    6$ find . -name "*.jpg" -print|xargs rm
    7$ cd ..
    
    Note that the 1$, 2$, etc., is the command prompt. The prompt on your system will look different.

    "1$" is just an example of using "cd" to get you into the "Photography" directory.

    "2$" copies the entire "RAW" directory to the "JPG" directory.

    "3$" makes "JPG" the active directory. You must do this or the next command is very bad! You can type "pwd" to verify what directory you are in.

    "4$" deletes all files with the ".nef" extension in all directories inside the "JPG" directory. This is a very dangerous command if executed from the wrong directory. That is why the "3$" command is important to get right.

    "5$" makes "RAW" the active directory. You must do this or the next command is very bad! You can type "pwd" to verify what directory you are in.

    "6$" deletes all files with the ".jpg" extension in all directories inside the "RAW" directory. This is a very dangerous command if executed from the wrong directory. That is why the "5$" command is important to get right.

    "7$" moves you back to the "Photography" directory.

    That's it.

    S-
     
  3. sidewinder macrumors 68020

    sidewinder

    Joined:
    Dec 10, 2008
    Location:
    Northern California
    #3
    You could it this way and save a lot of copying:

    Code:
    1$ cd /Users/you/Photography
    2$ mkdir JPG
    3$ cd RAW
    4$ find * -type d -exec mkdir ../JPG/\{\} \;
    5$ find . -name '*.jpg' -print | cpio -pad ../JPG
    6$ find . -name '*.jpg' -print | xargs rm
    7$ cd ..
    
    Note that the 1$, 2$, etc., is the command prompt. The prompt on your system will look different.

    "1$" is just an example of using "cd" to get you into the "Photography" directory.

    "2$" Create the "JPG" directory.

    "3$" Make the "RAW" directory the active directory.

    "4$" This command replicates the directory structure of "RAW" in "JPG".

    "5$" This copies all the "*.jpg" from the "RAW" directory to the right places in the "JPG". At this point I would verify that all the files you want in the JPG directory structure are actually there.

    "6$" deletes all files with the ".jpg" extension in all directories inside the "RAW" directory. This is a very dangerous command if executed from the wrong directory. That is why the "5$" command is important to get right.

    "7$" moves you back to the "Photography" directory.

    That's it.

    S-
     
  4. Phil Lee thread starter macrumors 6502

    Joined:
    Mar 19, 2008
    Location:
    Manchester, UK
    #4
    Thanks for the help. I used the second method and it worked well once I'd got the case of the file extension correct.
     
  5. sidewinder macrumors 68020

    sidewinder

    Joined:
    Dec 10, 2008
    Location:
    Northern California
  6. MacBoobsPro macrumors 603

    MacBoobsPro

    Joined:
    Jan 10, 2006
    #6
    I see you have acheived what you wanted. I was thinking along the lines of smart folders?
     
  7. sidewinder macrumors 68020

    sidewinder

    Joined:
    Dec 10, 2008
    Location:
    Northern California
    #7
    A Smart Folder would not create the new directory structure or place the files in the correct place within the new directory structure. Nor can you limit the search to certain directories either.

    Other than that.....

    S-
     

Share This Page