If I had 400 USB flash drives to initialize...

Discussion in 'Mac Programming' started by toddburch, Sep 22, 2007.

  1. toddburch macrumors 6502a

    Dec 4, 2006
    Katy, Texas
    Could an Applescript handle it?

    Here's the potential situation. A conference is coming up and I want to hand out little logo-ed flash drives preloaded with my software. On my Mac, I have 2 USB ports on the keyboard, 2 on the front of the tower, and I think I even have a spare hub around here somewhere.

    I'm wondering how fast I could insert a flash drive, have the software copied to it, and (logically) ejected, utilizing all available USB ports in a named fashion.

    So, I envision something like this:

    Start an applescript or some other process- it's now waiting for any volume mount action. I insert a USB flash drive on the left side of my keyboard. The script sees the volume and starts copying a predetermined folder to it.

    I insert the next flash drive, on the right side of the keyboard, and same thing. Then, on the top port of the front of the tower.

    About that time, the copy to the first USB drive is done. The script logically ejects that USB drive and then it prompts me to remove the "left keboard usb drive and to insert another".

    Is this possbile with an Applescript? I think the key points here are:

    1) named USB ports
    2) multi-tasking the copying of files
    3) automatically "ejecting" the drive

  2. gnasher729 macrumors P6


    Nov 25, 2005
    I think there are companies that will sell you USB sticks, with any branding that you want, and with any data that you want preloaded, for reasonable prices. Probably cheaper and easier than anything you can do yourself.
  3. lilrichie macrumors regular

    Feb 13, 2007
    I am with Gnasher on this one by the time u have executed the script mounted the drive copied the files and then had the drive un-mount again u are looking at 2-3 mins that is alot of time depending on where u do this it could also be costly.
  4. kainjow Moderator emeritus


    Jun 15, 2000
    You could probably attach a folder action to the /Volumes folder that would detect the USB drive (if they're all the same, you could probably just do a size comparison for now) and then copy files to it. However it'd probably be faster to have the AppleScript execute some shell script that handles identifying the USB drive and copying of files.

Share This Page