Script to take every 5th file from a folder and copy it to another folder

How can I tell applescript to take every 5th file of a folder of say 2000 files and copy them to another location? I want to copy the 5th, 10, 15th, 20th files and so on of 2000 files so I will have only 400 files.
I guess I want to make a list of all the files and then coerce that to the first and then increments of five but how do I do that?
Thanks.
Pedro

Hi Pedro,
The following script should do what you are asking for:
*set theSourceFolder to choose folder with prompt "Select the source folder."*
*set theTargetFolder to choose folder with prompt "Select the target folder."*
*tell application "Finder"*
*set theFiles to files of theSourceFolder*
*repeat with k from 5 to (count theFiles) by 5*
*move item k of theFiles to folder theTargetFolder*
*end repeat*
*end tell*
Message was edited by: Pierre L.

Similar Messages

  • Is there anyway to take a downloaded app from one computer and put it on another without rebuying it. I have a macbook that I bought the new iMovie and iPhoto on, but I would rather it be on my iMac. So is there anyway I can change it?

    Is there anyway to take a downloaded app from one computer and put it on another without rebuying it. I have a macbook that I bought the new iMovie and iPhoto on, but I would rather it be on my iMac. So is there anyway I can change it? I thought that if I bought it the apps on my macbook, they would be avaliable on my imac like the mobile devices operate. The macbook has 10.6.8 cause its a older model and I think lion would slow it down. Any help??

    Just redownload it on the other computer by logging into the App Store with the same Apple ID you used to purchase it.

  • How do I take my iTunes library from my ipod and move it to another iTunes on another compuyter?

    How do I take the songs on my ipod and download/transfer them to another computers iTune library?

    Excellent! Do I need to do anything to ensure the the program installs on the new computer? Do I need to make sure the computer is connected to the Internet when I uninstall the program from the old computer?

  • Copy a linux OS and files from one device and run them on another

    VM or physical?

    I have a device running a linux os and I want to copy its OS and files and then run them on a custom built machine. Is this possible and how would I go about doing it remotely say with FTP?
    This topic first appeared in the Spiceworks Community

  • 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

  • How can you take a photo from one event and put it in another, without dragging to desktop and dragging back into iPhoto and moving it to the event folder I want it in.

    As the title says I need help on how to take a photo from one event and put it in another, without dragging to desktop and dragging back into iPhoto and moving it to the event folder I want it in. Right now when I want to move a picture from one event to another I drag it to my desktop then delete it from iPhoto then I drag it back into iPhoto and put where I want it.An example would be taking a photo from the Christmas event and add it to a specific person event.  Can I do that within the events section without all the dragging. Also is there anyway I can remove duplicates from iPhoto without going through each and every file. Any help would be greatly appreciated.

    Apple doesn't make it easy to do what you want.  However, here's how I do it. 
    Select the photo you want to move and create a new Event for it via the Event ➙ Create Event menu option.
    In the Event mode select the new Event with the one picture and drag it onto the Event you want to move the photo to.

  • What are the commands available to read a file from application server and

    What are the commands available to read a file from application server and store the file into an internal table?

    Hi,
    To read a file from an Application Server to an Object there is a command in ABAP called <b>READ DATASET</b>. After that file is transported to that object you have to do a loop and put that data in an Internal Table.
    This statement exports data from the file specified in dset into the data object dobj. For dobj, variables with elementary data types and flat structures can be specified. In Unicode programs, dobj must be character-type if the file was opened as a text file.
    For dset, a character-type data object is expected - that is, an object that contains the platform-specific name of the file. The content is read from the file starting from the current file pointer. After the data transfer, the file pointer is positioned after the section that was read. Using the MAXIMUM LENGTH addition, the number of characters or bytes to be read from the file can be limited. Using ACTUAL LENGTH, the number of characters or bytes actually used can be determined.
    In a Unicode program, the file must be opened with an arbitrary access type; otherwise, an exception that cannot be handled will be triggered.
    If the file has not yet been opened in anon-Unicode program, it will be implicitly opened as a binary file for read access using the statement
    OPEN DATASET dset FOR INPUT IN BINARY MODE.
    . If a non-existing file is accessed, an exception that can be handled can be triggered.
    Influence of Access Type
    Files can be read independently of the access type. Whether data can be read or not depends solely on the position of the file pointer. If the latter is at the end of the file or after the file, no data can be read and sy-subrc will be set to 4.
    Influence of the Storage Type
    The import function will take place irrespective of the storage type in which the file was opened with the statement OPEN DATASET.
    If the file was opened as a text file or as a legacy text file, the data is normally read from the current position of the file pointer to the next end-of-line marking, and the file pointer is positioned after the end-of-line marking. If the data object dobj is too short for the number of read characters, the superfluous characters and bytes are cut off. If it is longer, it will be filled with blanks to the right.
    If the file was opened as a binary file or as a legacy-binary file, as much data is read that fits into the data object dobj. If the data object dobj is longer than the number of exported characters, it is filled with hexadecimal 0 on the right.
    If the specified storage type makes conversion necessary, this is executed before the assignment to the data object dobj. Afterwards, the read data is placed, byte by byte, into the data object.
    System Fields
    sy-subrc Meaning
    0 Data was read without reaching end of file.
    4 Data was read and the end of the file was reached or there was an attempt to read after the end of the file.
    Thanks,
    Samantak.
    <b>Rewards points for useful answers.</b>

  • How can I move an icon/file from one screen of my ipad to another?

    How can I move an icon/file from one screen on my ipad to another?

    Press and hold the icon until they start to wiggle. Then while holding it, drag it to the edge of the screen and wait for the page to switch, then let go of the app

  • Is there a way to open Excell file from the server and display in the UI and save it back on to the

    Hello there,
    Is there a way to open Excell file from the server and display in the UI and save it back on to the server? (like showing xell file as a datagrid - add rows, columns etc.)

    Hi Mike,
    Welcome you to the forum.
    You may try:
    SELECT * FROM MyDBNameHere.dbo.OUSR T0
    Thanks,
    Gordon

  • How do a scan a file from my scanner and make it a PDF. . . . I do not see this choice in the Adobe program?

    How do a scan a file from my scanner and make it a PDF. . . . I do not see this choice in the Adobe program?
    In the past I would simply place a copy of the document on my scanner, then selected create PDF from scanner.  However, there is now no create PDF from scanner alternative, option or choice.  The only option available is selected file to convert to PDF.  what am I to do?

    That would have been a function of your scanning software. Adobe Reader is only used to view the pdf that your scanning software created.

  • How to download a file from the net and save it into .txt format in a datab

    Can some one show me a tutorial on how to download a file from the net and save it into .txt format in a database?
    Thank you,

    http://java.sun.com/docs/books/tutorial/networking/urls/readingWriting.html

  • How can I get data in flat file from Pool table and cluster table ?

    Hi,
    I am working in one Achiving project. My requirement is to get data into flat file from Cluster table and pool table.
    Is there any tool avilable to download data into flat file from pool table and cluster table ?
    if table name given in the selection screen then data will be downloaded into flat file.
    waiting for quick response.
    Best Regards,
    Bansidhar

    Data cannot be retrived directly form the cluster table
    as the Cluster results are stored in Cluster Key say for example PCLkey
    and form that Key we need to fetch the data
    these clustes are not the part of PNP or PNPCE tables
    for ur info kindly check

  • I have an extensive aperture library on my computer's hard drive and I want to break it up into separate smaller libraries on external hard drives.  How do I take projects from one library and add them to another one?

    I have an extensive aperture library on my computer's hard drive and I want to break it up into separate smaller libraries on external hard drives.  How do I take projects from one library and add them to another one?

    Coastal,
    Frank gave you the exact answer to your question. 
    However, I would like to ask if you are indeed asking the right question.  Do you really want different libraries?  The implications are that you have to "switch" libraries to see what's in the others, and so that your searches don't work across all of your pictures?  If so, then you asked the right question.  If not, you may be more interested in relocating your masters to multiple hard drives so your library gets smaller, instead of breaking up the library.
    nathan

  • How long does it take to get approval from iTunes Connect and how do I find out if they are working on it?

    How long does it take to get approval from iTunes Connect and how do I find out if they are even working on it? I'm not really sure if my application was even delivered - from the links in IBA. Any suggestions how one might push the right buttons at Apple?
    Also went around in a big circle trying to get beyond the confusion of not having the right Apple ID when I've had it a long time. Confusion abounds and learning this forum also takes a new degree of patience. Humbling to say the least :-)
    Anyone been there done that?

    [email protected]
    [email protected]
    …support phone number call +1 (877) 206-2092.
    Global Phone Support
    We have expanded English-language publisher phone support. To make contacting the iBookstore support even easier, new local phone numbers are now available for Australia, France, Germany, Italy, Netherlands, Spain, and the U.K. Support is available Monday to Friday, from 7 a.m. to 5 p.m. (PT).
    Country
    Phone Number
    Australia
    1300 307 504
    Note that this is a low tariff number.
    France
    0805 540 117
    Germany
    0800 664 5307
    Italy
    800 915 902
    Netherlands
    0800 0201 578
    Spain
    900 812 687
    U.K.
    0800 975 0615
    U.S.
    +1 (877) 206-2092
    Toll-free from U.S. and Canada.

  • I deleted a very important pages file from my iPad and I need it back

    I deleted a very important pages file from my iPad and I need it back pronto! I just updated my iPad without a computer and it had the file there. I need to know how to get back the file very quickly.
    thx in advance

    Thne unfortunately, your document is gone. You can restore lost or deleted documents from backups if you have backups - and as long as the backup contains the document - but if you did not copy the file to your computer - or backup the iPad, the document is gone.
    You really should start backup up your iPad. You can sign up for a free 5GB iCloud account right on the iPad and then you can use iCloud for backing up. You can do it right on the iPad.

Maybe you are looking for

  • How do I transfer my library from one PC to another?

    Hey friends I have just bought a new computer. Does anyone know how to transfer my music and itunes software from my old computer to my new one? Any help will be appreciated. Regards Will

  • Time Capsule Set Up With Neighbor's WiFi

    I use my neighbor's WiFi (with permission and password). I can't get the set up for my time machine to work. I keep hitting this wall where it no longer can find my wireless device (the time capsule) after I "connect" the airport utility to the exist

  • Can I run it?

    Hello everybody! I've just one question, I'll install Mac OS 10.7 Lion but I don't now if my Macbook Pro can run it?  It's a 15.4-inch: 2.4GHz(MA896LL) NVIDIA GeForce 8600M GT with 256MB of GDDR3 SDRAM HDD 500Go 5400rpm 2GB (two SO-DIMMs) 667MHz DDR2

  • Alias disappearing in oracle 11g whereas it worked fine in 10.2.0.4

    sql@10g>select * from v$version; BANNER Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi PL/SQL Release 10.2.0.4.0 - Production CORE 10.2.0.4.0 Production TNS for IBM/AIX RISC System/6000: Version 10.2.0.4.0 - Productio NLSRTL Version

  • After installing elements 11 and using the editor, it will not reopen

    after installing elements 11 and using the editor, it will not reopen