Batch deleting files in a folder

Discussion in 'Mac Apps and Mac App Store' started by macrescue, Jul 30, 2008.

  1. macrescue macrumors newbie

    Joined:
    Jul 30, 2008
    #1
    Hi guys,

    i'm looking for an app that lets me batch delete files from a folder. It needs to pick every second file that is in a folder.

    Background: I take pictures with a photocam in endless mode for time lapse movies. The result is i have a folder with 3000-5000 jpg files. Often i need to delete every second pic to make the movie faster when i put it together with 30 fps.

    Do you have an idea for a tool that is capable of doing this. I already browsed versiontracker and tried Automater with no luck.

    Thanks in advance!
     
  2. cptpower macrumors regular

    cptpower

    Joined:
    Sep 10, 2007
    Location:
    Calgary, AB
    #2
    terminal is your friend! :)

    if you do an "ls -1 > file_list.txt", then you'll get a file with the names of all the files.

    Then you just have to edit that txt file, removing every second line, and then add at the beginning of each line "rm ".

    rename the file_list.txt as file_list.sh and run it. That'll remove all those files for you.

    note: there's a few different ways to go about removing every second line from the file; use your favourite text editor and whatever functionality it has to do that. I use 'vi', which you may not be comfortable at all using, so I won't discuss the instructions for it.

    note2: you may need to change permissions on the file_list.sh file so that it can be run. type "chmod 744 file_list.sh"; that should take care of it.
     
  3. Consultant macrumors G5

    Consultant

    Joined:
    Jun 27, 2007
    #3
    Set your cam or your photo capturing app to take pictures at longer intervals will be the actual solution.
     
  4. macrescue thread starter macrumors newbie

    Joined:
    Jul 30, 2008
    #4
    @cptpower:
    thanks buddy, great tip. I just tried it out and it works pretty good! I will definitely use it for folders >1.000 files.

    @Consultant
    Unfortunately i don't have any manual control over the capturing intervals. I use a rubber strap to keep the release pressed. It the only way with that cam to shoot pictures in endless mode.
     
  5. cptpower macrumors regular

    cptpower

    Joined:
    Sep 10, 2007
    Location:
    Calgary, AB
    #5
    Great to hear that it worked out for you.

    There may be an easier trick that having to use a text editor even but running the ls -1 a couple of times and piping it through grep. I haven't got much time to check that out right now, but I might play around with it tomorrow and if I find anything, I'll let you know!
     

Share This Page