Use automator to select every 3rd file to move to new folder?

I have an interesting 'problem' I think.
As a result of a time-lapse experminent, I have a folder which holds several thousands of pictures from a fixed point, made over several days & nights.
But there is one issue: the camera made 3 different exposures every 5 seconds.
This resulted in every 3rd picture 'belonging' to each other. So these have to be selected for going in a seperate folder. Menaing: pictures 1 and 4 and 7 and 10 .... they must go in one folder. 2 and 4 and 8 and 11.. in the second folder. Finally 3 and 5 and 9 and 12 in a third folder.
How to do this with software (to avoid injury) because of the thousands of pics.
Is this do-able with automator? How?
Tnx

This has come up a few times, so I tweaked one of my Automator actions a while back to do this. I thought I had uploaded it before, but the latest version of my *Trim Input Items* action is available on my iDisk here. It keeps or trims the input list to the selected number of items from the beginning, end, interval, or random locations. You may need to sort the input file list to get them into the desired order, since the action just works with the items in the list, and doesn't care what they are.
I haven't tested it with large file lists, but an example workflow using my action would be:
1) *Get Specified Finder Items* (or however you want to get the file items)
2) *Set Value of Variable* { Variable: _File List_ }
3) *Trim Input Items* { Keep Interval 3 items, starting from item 1 }
4) *Move Finder Items* { To: _First Location_ } -- move first batch
5) *Get Value of Variable* { Variable: _File List_ } (Ignore Input)
6) *Trim Input Items* { Keep Interval 3 items, starting from item 2 }
7) *Move Finder Items* { To: _Second Location_ } -- move second batch
8) *Get Value of Variable* { Variable: _File List_ } (Ignore Input)
9) *Trim Input Items* { Keep Interval 3 items, starting from item 3 }
10) *Move Finder Items* { To: _Third Location_ } -- move third batch

Similar Messages

  • How to make applescript to select every 3rd file to move to new folder?

    I have an interesting 'problem' I think.
    As a result of a time-lapse experminent, I have a folder which holds several thousands of pictures from a fixed point, made over several days & nights.
    But there is one issue: the camera made 3 different exposures every 5 seconds.
    This resulted in every 3rd picture 'belonging' to each other. So these have to be selected for going in a seperate folder. Menaing: pictures 1 and 4 and 7 and 10 .... they must go in one folder. 2 and 4 and 8 and 11.. in the second folder. Finally 3 and 5 and 9 and 12 in a third folder.
    How to do this with software (to avoid injury) because of the thousands of pics.
    Is this do-able with applescript? How?
    Tnx

    Hello
    You may try something like the following script.
    Main part is written in shell script for performance sake. AppleScript is only used for user interface.
    Please see comments in script for its usage and behaviour.
    And please test the script first with small subset of your images.
    (Since the script will scan the source folder tree for image files, it is good idea not to create destination folders in source folder tree.)
    Minimally tested with OSX10.2 at hand but NO WARRANTIES of any kind.
    Make sure you have full backup of your images before applying this script.
    Hope this may help,
    H
    image file (jpg) sorter
    v0.2
    Script will let you choose two folders, i.e. -
    a) source folder where images reside (directory tree under the chosen folder is scanned),
    b) destination parent folder where three subfolders will be made (named '0', '1', '2').
    The file number i is obtained by removing extension and non-digts from file name.
    The file with number i (0-based) in source tree will be moved to (i mod 3)'th subfolder in destination.
    e.g.,
    IMG_1440.JPG -> '0' (i = 1440, i mod 3 = 0)
    IMG_1441.JPG -> '1' (i = 1441, i mod 3 = 1)
    IMG_1442.JPG -> '2' (i = 1442, i mod 3 = 2)
    IMG_1443.JPG -> '0' ...
    IMG_9997.JPG -> '1'
    IMG_9998.JPG -> '2'
    IMG_9999.JPG -> '0'
    IMG_0001.JPG -> '1'
    IMG_0002.JPG -> '2'
    IMG_0003.JPG -> '0'
    image file name convention : ZZZZ_9999.jpg
    set src to choose folder with prompt "Choose source folder."
    set src_ to (src's POSIX path's text 1 thru -2)'s quoted form
    set dst to choose folder with prompt "Choose destination parent folder."
    set dst_ to (dst's POSIX path's text 1 thru -2)'s quoted form
    set sh to "
    # source directory
    srcdir=" & src_ & ";
    # destination directories
    dstdir=" & dst_ & ";
    dest=("$dstdir"/{0,1,2});
    # make destinations
    mkdir -p "${dest[@]}";
    # let k = number of destination directories
    k=${#dest[@]};
    # sort files to destinations such that -
    # 1) number i is obtained by removing extension and non-digits from file name; and
    # 2) file with number i is stored in (i % k)'th destination, where i is zero-based.
    # e.g. Given xxxx_9999.jpg, k = 3;
    # i = 9999 and the file is sorted to destination 0 (= 9999 mod 3)
    find "$srcdir" -type f -iname '*.jpg' -print0 | while read -d $'\0' f;
    do
    leaf=${f##*/}; # get file name
    stem=${leaf%.*}; # remove extension
    i=${stem//[^0-9]/}; # remove non-digts from file name
    let i=0+10#$i; # to interpret, e.g., 010 as 10, otherwise 010 is treated as octal.
    # echo "$i $f ${dest[i % k]}"; # for testing
    mv "$f" "${dest[i % k]}"; # move file
    done
    do shell script sh
    display dialog "Done" with icon 1 giving up after 20

  • Select every nth file from a folder

    Hello:
    I have a file on my computer that has about 2200 word documents and I need to select every 10th file and place it into another folder. I have zero expierence with this stuff, especially since my imac is my first mac ever; I have had it for about 2 months. Any help would be greatly appreciated !
    Thanks

    This script
    set sourceFolder to choose folder with prompt "Select Source Folder"
    set destinationFolder to choose folder with prompt "Select Destination Folder"
    set diag to display dialog "Set skip count" default answer "10"
    set skipCount to (text returned of diag) as integer
    tell application "Finder"
              set theFiles to the files of sourceFolder
              repeat with n from skipCount to (count of theFiles) by skipCount
      duplicate item n of theFiles to folder the destinationFolder
              end repeat
    end tell
    will prompt you for the source and destination folders (the destination folder must exist already) and then prompt for the number of files to skip.
    It will duplicate the selected files from the source to the destination. If you do not want the files to remain in the source folder replace duplicate with move in the script.
    To make the above into a script select all the text in the box then right (control) click the selection, select Services->Make New AppleScript.
    As with all script gotten from the web make sure you test it out on some dummy files first and make sure you have backups of the data you are working on.
    regards
    Note this will start with the file at skipCount and increment from there. That is with the skipCount set to 10 the first file moved is file number 10 then 20, 30, etc.
    Message was edited by: Frank Caggiano

  • Can't delete, rename files, or move to another folder

    I had posted earlier about not being able to delete, rename files, or move to another folder. It never was resolved here, and I guess Apple still hasn't done anything about it. Here's a great workaround I found though in case others need something. Download the program called "Unlocker", it's free and you can get it at http://ccollomb.free.fr/unlocker/ When you get the message about the file being in use, even though QuickTime isn't even open, you can unlock the f'ing file and do whatever you want to then, move, uh DELETE, or rename, or whatever. Try it, it's the best thing going so far seeing Apple isn't doing anything about this problem.

    Hi there,
    I am still struggling with this problem. Actually my coworker has the same machine, Apple pro with windows xp installed, but he does not have this problem with his quicktime 7.5. I uninstalled 7.5 and installed 7.2, but it did not solve the problem. The fact is that I don't have the problem in my laptop which I am using it in the office. I am still trouble shooting. Hopefully I can find an answer.
    Peace

  • Yosemite Every time i do login a new folder appear

    Every time i do login a new folder appear somewhere on my desktop. I have installed Yosemite

    What is the name of this folder?  What is in the folder?  What Login Items do you have? Does this occur for a different user, e.g., Guest?  Does this occur when starting up in Safe Mode?

  • How can I use automator to import a .csv file into a an excel file

    I would still like all the import settings that I get if I am using excel to do the process, i.e. going in with the text format instead of the general format. That way my dates don't change

    You'll need to use Applescript in Automator.
    Note:  File extension cannot be CSV (Excel will assume that the file is comma separated), so add an action to copy or rename with extension TXT.
    (You can rename back at end of Workflow is needed)
    The Applescript Action is:
    on run {input, parameters}
         repeat with f in input
              tell application "Microsoft Excel"
                   open text file filename (f as string) data type delimited field info {{1, text format}} other char "|" with use other
              end tell
          end repeat
          eturn input
    end run
    NOTE: This is formating the 1st col to text
    If you need to format the second, then you need to:
      open text file filename (f as string) data type delimited field info {{1, general format}, {2, text format}} other char "|" with use other
    (You'll need to list the 1st col, 2nd col, etc until you get to the col to format as text).  Formats are (from the Applescript Excel Library):
    [field info list] : A list contain parse information for the individual columns of data.
    Formats are general format, text format, MDY format, DMY format, YMD format, MYD format, DYM format, YDM format, skip column.
    Or you can skip using Automator and just use an Applescript App (this is a droplet, just drop the files on the icon, or click to choose files):
    on run
         set fs to choose file with prompt "Select one or more files to open:" default location alias (the path to desktop folder as text) with multiple selections allowed
         proceed(fs)
    end run
    on open fs
         proceed(fs)
    end open
    on proceed(fs)
         repeat with f in fs
              tell application "Microsoft Excel"
                   open text file filename (f as string) data type delimited field info {{1, text format}} other char "|" with use other
               end tell
          end repeat
    end proceed

  • Using Automator to Find Date in file name--Help!

    Hey guys,
    I have this automator question.
    Daily I record a radio show. Due to cpu limitations I cannot record it right to AAC. (I use the radio shark) So I record it to aiff format. Radio shark adds in the current date to the file name so I know what date the show is from. What I need to know is if I can get an Automator action to find a file in the Radioshark folder with "Radioshow" and the Current Date in the filename.
    How can I have automator use the current date to search for the file.
    I need the date variable included because sometimes my automator app doesn't delete the old file, so at times the radio shark folder could contain numerous "RadioShow" files.
    Any help appreciated.
    17inch Imac 800Mhz/12 inch PB   Mac OS X (10.4.6)  

    Hey thanks. That did work. A new question. It takes about 60 minutes to import the file. Once the file is imported I would like automator to change the Track Info and put it into a specific playlist.
    Most of the time the file imports but does not finish the actions in automator (the track info and moving it to the playlist). I am assuming that it is "timing out" during the import process. Is there a way to pause the automator actions for 60 minutes after it begins the import process and then completed the subsequent actions?
    Any help appreciated!
    Craig

  • I used automator to rename some pages files, and now they can't be opened

    I used automator to remove some text from the filenames of a group of pages files, and now they can't be opened. What went wrong?

    Did you by any chance remove the file type extension?
    Walt

  • How can I use automator to copy and paste excel content to a new empty document?

    Hi,
    I would like to copy and paste the content from an excel file to another empty new document using automator, which I created a workflow like below
    get specific finder item
    open excel workbook
    select cell from excel workbook (all content)
    obtain selected content from workbook
    copy to pasteboard the content of excel workbook
    close the excel workbook
    create new excel workbook
    paste copyboard content to excel workbook
    can anyone kindly suggest what's wrong with this workflow?
    Thank you so much
    Eddy
    (i know this is a number place but I couldn't find any excel seciton sorry guys...)

    now it only does one file at a time, whereas I would like to do multiple files simultaneously.
    If you try a search for "loop Automator" and also "folder actions" you may find some usable pointers on how to do that.  The first example on this page looks promising.
    SG

  • Every time I save a file it creates a new folder

    Hi,
    weird problem, never occurred on other Macs. I have a preso and every time I save it I see an Expander application running which creates a new folder file. Let's say I have a preso called Effects.key, when I save it or in auto-save it creates Effects.key folder,   Effects.key folder 1,  Effects.key folder 2,  Effects.key folder 3......an on and on and on....
    What's happening ?
    Thanks in advance

    try this:
    right click on one of the original Keynote files, select;   get info
    in the Open With dropdown option; (if Keynote is not the listed), select other,
         then navigate to Keynote in the Applications folder
    select; always open with
    click add

  • Procedure to move highlighted files en masse to new folder

    This procedure should be quite simple, but it escapes me!
    How can I move an entire group of highlighted files into a new folder?

    nkh wrote:
    Hi bd,
    This is the procedure I tried before pleading for help. Although the whole group of files is highlighted, the drag-drop routine only transfers the single file for the icon I drag. The others remain highlighted, but do not move as a group!
    Mouse control.
    Typically an inadvertent 2x click on the file name "deselects" the group and re-selects just the file you are pointing at when you click.
    But you know what you want to do, so your hand is already performing the drag/drop before your head registers that only one file is now selected.
    Happens to me on a semi-regular basis.
    After you have selected the group of files, (assuming list view) try pointing at the date/or time area, click and drag from there instead of the filename.

  • Media Files Sorted/Copied into new folder

    I have a huge project and thousands of files I need to find all the media(quicktimes) of specific shots with the same shot/take lable and copy those files into a new folder so i can send them to someone else to edit with.

    Highlight all the clips in the BROWSWER that you want to transfer and use the MEDIA MANAGER and the COPY option.
    Shane

  • Bridge cs6 . I can't select more than 1 file even when I use ctrl and select a few files. Bridge will just open them indivudually.It was working properly a week ago.

    I cannot open multiple files on Bridge cs6  on my pc. I hold down ctrl. but it just opens them individually. This function was working in the past. caps lock is off, nothing has changed....help.

    As I select a file, it will launch its application automatically. Therefore I can not select multiple files or just single files without opening the application.
    I did not have this problem before. I started having this problem after I updated my system to OS X Yosemite.
    I tried to reset Bridge preferences, installed updates, but nothing worked so far.
    Can anybody help?

  • Using external hard drive for music files NOT in iTunes music folder

    Hi there. Due to lacking disk space on my computer I have all my music files (that I had before using iTunes) on an external HD. I can easily import these drives to iTunes (v.8) without copying them to the iTunes music folder. But when I want to synchronize my iPod the next time, iTunes cannot find the files on my external HD and I have to import them all again, delete all the duplicates and - worst of all - do all the playlist sorting again! Is there a solution to this without putting all my music into the iTunes music folder (I would like to keep it separated)? Thanks in advance!

    I use an external firewire drive to store my iTunes library on. One thing to be aware of...
    You need to go into your iTunes preferences, then to "Advanced", then select the location where you want to store your iTunes Music folder. In my case it is in a folder titled "Music" on my external firewire drive. The iTunes "Library" file is stored on your internal hard drive.
    The thing that can cause you problems it that....if you forget to turn on the external drive before you boot up your Mac, the iTunes library file will look for your music folder and won't be able to find it. So a new iTunes Music folder will be created on your internal hard drive, with nothing in it. You'll see all of your songs listed in your iTunes program...but if you try to double click on any of the songs to play them, you'll get an exclamation mark saying "cannot find file".
    If this happens, you need to delete the new iTunes Music folder on your internal drive (but not the iTunes Library file!), then quit iTunes, turn on the external drive, then relaunch iTunes....and it will find the original music folder.
    It's a hassle that I have had to go though many times, I keep forgetting to turn on that drive before launching iTunes.
    Oh, one other thing....about the way you worded your post. You aren't running short on "memory", you are running short on "storage"....they are two different things. Hard drives are storage, RAM chips are "memory" that run your programs.

  • ITunes not recognizing my files after move to new Powerbook

    Just moved all my stuff over to my new computer (Powerbook G4) using migration assistant and while everything else seems to be working fine, iTunes is not recognizing the folder with all my songs in it, called "iTunes Music" in my iTunes folder in my Music directory. Any ideas why it's not being seen? I'd hate to import them, since I believe iTunes would be making copies of each song.
    Thanks.

    Thanks for your response. I'm on iTunes 4.7.1 on a new Powerbook G4 running OS 10.4. I was using a Powerbook G4 rental with OS 10.4.2 that I'm about to return. It's in the process of being zero'd out so I can't check the iTunes version but I think it was running iTunes 4.9, now that I think about it. I guess it was my mistake to think a brand new Powerbook would be running software more recent that a rental.
    I didn't do any replacing of the music folder, since I used an automated "mover" program that ran when I first started this machine called "Migration Assistant" or something like that that did an amazing job of moving everything over from the rental to this new one. It was just like I was on the rental--my desktop, applications, dock, and everything else was set up the way it was before, with the exception, it seems, of iTunes.
    iTunes started as if it were opening for the first time and looks that way. None of my songs show up, though they're in my user folder in Music > iTunes> iTunes Music, each album in a separate folder inside, including the albums I bought through iTunes. Still, no playlists or songs show within my iTunes application, nor does the "purchased music" category show up at all (typical, I guess, when it doesn't think you've yet purchased anything).
    Also in my iTunes folder is:
    - a file called iTunes 4 Music Library
    - a file called iTunes Library
    - a file called iTunes Library.xml
    - a folder called Previous iTunes Libraries which contain an iTunes 3 Music Library and and iTunes 4 Music Library. Both of these are documents, not folders.
    I'm hoping there's a way to trick iTunes into seeing this stuff, maybe moving everything out, upgrading and then moving them back in some way? Thanks for the help! Have a kids birthday party in a few hours and hoping to use my iTunes to make some playlists and maybe buy some more songs.
    By the way, I have an iPod that I synched to the rental recently. Might be missing some playlists but all the music is on that, too.
    Thanks!
    Bob

Maybe you are looking for

  • ESYU: ENCOIN: ECO Open Interface Program 사용시 error 발생 문제

    Purpose Oracle Engineering - Version: 11.5.6 ECOs import를 위해 ECO Open Interface(ENCOIN module)을 사용할 때, Interface program이 아래와 같은 error를 발생시킨다. "ORACLE error 6550 in FDPSTP Cause: FDPSTP failed due to ORA-06550: line 1, column 7: PLS-00201: identifier

  • SALES ORDER REASON FOR REJECTION NOT WORKING .

    Hi Friends Though user mention reason for rejection in preceding sales orders'  line item s,still  those line items are being copied to subsequent documents ( to another sales order and billing document ) . Do you feel  there may be  problem is in  s

  • Mail_Receiver: Send Mail with attachment

    Hi everybody, I need some help. I want to send a mail with attachment. for this I have imported SAPs xsd for the mail adapter. I wonder how to map the target fields? The following causes five! attachments in SXMB_MONI and the adapter throws java.lang

  • Error in Cube Deployment from Essbase Studio

    Hi All, I am very new to ESSBAE Studio. I build up a minischema, dimension element(drag and drop from minischema), hierarchy(using dimension element) , Cube Schema and Meta model. Now when I'm going to deploy the model to Essbase Console It throws er

  • How to implement isTokenValid in JSF ?

    Hi guys, How to implement a same function in JSF for the org.apache.struts.action.Action.isTokenValid in struts ? Please help, Thanks ! cheers, Mark