Script Help: Folder Actions - Move files

Hi,
So, I'm having some trouble writing a script for a folder action. I basically want the folder to check the file extension of the files that I add to the folder, and if they are music files (mp3, m4a, m4p), to move those files to a different folder. Additionally, is it possible to also move entire folders containing music files to a different folder, instead of just single files?
Thank you for any help.

What is your script doing now (note that a name extension does not include the period delimiter)? You can move entire folders, but your folder action script would only pass the items added to the attached folder, not any folder contents. Your folder action script would need to look into any passed folders if you wanted to move them based on their contents.

Similar Messages

  • Folder Action + Move Finder Items = Zero KB files

    I've got a folder action set that is supposed to run the Automator Action "Move Finder Items" on any file that gets placed in a specific folder (called "Folder A") and move it to "Folder B". I'm having an issue with larger files though.
    As soon as I begin to transfer the file to "folder A" , the folder action runs and results in a "Zero KB" file in "Folder B".
    Is there any way to keep the Folder Action from triggering until the file has completely copied to the folder with the Folder Action attached ("Folder A")?
    A side note: I have this same folder action running on an iMac with Mac OS 10.6.3 and it works great . (This one was made with the newer version of Automator that shipped with 10.6 vs. Automator on 10.5 which made the action I am having trouble with)
    Any input would be appreciated!

    There is a check in *Snow Leopard* to see if the items have completed their copy/download, but Leopard does not do any checking - the script is triggered immediately. You can add your own delay with a *Run AppleScript* action, though, for example:
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    font-weight: normal;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px; height: 340px;
    color: #000000;
    background-color: #DAFFB6;
    overflow: auto;"
    title="this text can be pasted into an Automator 'Run AppleScript' action">
    on run {input, parameters} -- wait for file copy to complete by testing the size of the containing folder
    set theFolders to {} -- to handle items in different folders
    set skippedItems to {}
    repeat with anItem in the input -- get a list of unique folders
    tell application "Finder"
    get (container of anItem) as alias
    if the result is not in theFolders then set the end of theFolders to the result
    end tell
    end repeat
    repeat with aFolder in theFolders
    set timeToWait to 30 -- time to wait for copy to complete
    set interval to 2 -- test every interval seconds
    set copied to false
    tell application "Finder" to set currentSize to size of aFolder -- get initial size
    repeat with timer from timeToWait to 1 by -interval -- check every interval seconds up to maximum time
    delay interval
    tell application "Finder" to set newSize to size of aFolder -- recheck size
    if (newSize is equal to currentSize) then
    set copied to true
    exit repeat -- success
    else -- update size
    set currentSize to newSize
    end if
    end repeat
    if not copied then set the end of skippedItems to quoted form of (aFolder as text) -- timed out
    end repeat
    showSkippedAlert for skippedItems
    return input
    end run
    to showSkippedAlert for skippedItems
    show an alert dialog for any items skipped, with the option to cancel the rest of the workflow
    parameters - skippedItems [list]: the items skipped
    returns nothing
    if skippedItems is not {} then
    set {alertText, theCount} to {"Error with waiting for items to copy", count skippedItems}
    if theCount is greater than 1 then
    set theMessage to (theCount as text) & space & " folders timed out"
    else
    set theMessage to "1 folder timed out"
    end if
    set theMessage to theMessage & " - copy of contents may be incomplete:"
    set {tempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, return}
    set {skippedItems, AppleScript's text item delimiters} to {skippedItems as text, tempTID}
    if button returned of (display alert alertText message (theMessage & return & skippedItems) alternate button "Cancel" default button "OK") is "Cancel" then error number -128
    end if
    return
    end showSkippedAlert
    </pre>
    The action will check the folder sizes, and when there is no change (or the wait times out) the input items are passed on.

  • Folder action - open file in quicktime

    I'm trying to do something I think should be simple, but I can't seem to make it happen.
    I get voicemails as .wav files in email. I'd like to save these to a folder, and have them automatically open up with quicktime player.
    I've verified that I've got folder actions working, as I've tested some of the example scripts for converting files. However, this script fails silently. What clue am I missing?
    on adding folder items to thisFolder after receiving these_items
    tell application "QuickTime Player"
    open file these_items
    end tell
    end adding folder items to
    Thanks for any help!
    - Steve

    My guess is that what you're missing is that these_items is a list therefore you can't open file <list> since you cannot coerce a list to a file.
    (note this is true even if there's only one file - it's a list of one item)
    Ironically, you may be able to:
    open these_items
    since you're not trying to coerce the list to a file (QuickTime Player will look at each item in the list and work it out).
    Alternatively, the typical approach is to iterate through the list:
    on adding folder items to thisFolder after receiving these_items
     repeat with each_item in these_items
      tell application "QuickTime Player"
       open each_item
      end tell
     end repeat
    end adding folder items to

  • Folder actions - copy files AND subfolders

    I cannot seem to get folder actions working in the expected way.  I have no problem creating a folder action that copies files into the target destination folder.
    But if I create a new folder in the source folder (i.e. a subfolder) it does not create that same subfolder in the target. And of course by consequence, does not copy the subfolders files into the target either.
    Can anyone recommend an automator folder action step that I may be missing?  I'd appreciate any feedback, thanks!

    Thanks for offering to help. 
    I'm using automator with the following two steps:
    - first the default step where automator asks for a folder to attach the folder action to. I selected a folder called test input 1
    - second step is the 'copy finder items' step. I designated a named folder 'test output' and selected the checkbox 'replace existing files' (although I know that all of the folders/files that will be placed in the initial folder will be unique
    I just discovered that I pulled a bit of a rookie mistake. I had the target folder open and incorrectly assumed that my script wasn't working. When in fact I needed to close and reopen the window to refresh.
    However...
    After testing this script quite a bit, it seems very inconsistent.  While subfolders to get created, dragging and dropping some files yields a total inconsistency in the results. I have a particular PDF that refuses to get copied to the target via this script in a subfolder. 
    So I guess my updated status is: I have a script that works, but I don't really trust it because it doesn't always work properly.

  • Create folder (rename), move files and delete source

    This seems a simple and obvious need but I cant find anything to help.
    I want to be able to create a folder with a unique name (I would prefer to input the folder name when the workflow is run), move some files into it, and ensure the source files in the original location are deleted.
    The problem with the create new folder action as it stands is that it COPIES any files passed into it. I want to MOVE the files into a new folder.
    Am I missing something obvious?

    There's no out of the box way to achieve what you're looking for.
    Two solutions:
    1. Your users would need to open the entry first and then click on the "edit this file" link.
    2. You could code your own folder view or landing page element and build what you need.
    HTH
    Cheers
    Erik
    PS: Feel free to contact me offlist if you need professional support.

  • Delaying folder action until file creation is complete

    I'm trying to create a folder action that takes the output of a bounce from ProTools and then imports it into iTunes. The problem I'm having is that it takes real time (about 20 min) to create the complete ProTools file in the folder, however the script begins to execute immediately, before the bounce is complete. This gives me 1 second of audio garbage.
    Is there any way to delay the folder action until the file creation (bounce, upload, transfer, whatever) is done?
    Thanks.

    V.K. Thanks again for your help. When I look in my folder directory/library/scripts/folder action scripts, I see many scripts for images as well as scripts for closing subfolders, converting to pdf, open - show comments in dialog, and add - new item alert, however I don't see anything that was created recently (i.e. something that was created when I built my Automator workflow (folder action). The closest (to what I am looking for) Folder Action Script could find was "add - new item alert.scpt", which is an existing Apple written script, but this will not really help me. When I created my initial automator script, it created a folder and file and workflow in my homefolder/library/Workflows/Applications/Folder Actions/xxx.workflow, however I cannot open this workflow in applescript. I even tried changing the extension to .scpt. I'm not sure I can accomplish the desired result with Automator alone, but I don't think I am well versed enough in AppleScript. Thanks for your help.

  • From script to Folder Action?

    Sample script:
    tell application "Finder"
    set List1 to {"VNG", "COW", "SIN", "CVR", "CRM"}
    set List2 to {"VNG", "SIN"}
    set MissingList to {}
    repeat with i from 1 to count of List1
    if item i of List1 is not in List2 then
    set end of MissingList to item i of List1
    end if
    end repeat
    display dialog MissingList as text
    end tell
    Works, gives me what I want - answer as "COW, CVR, CRM"
    I make a Folder Action from it, like this:
    on adding folder items to this_folder after receiving added_items
    tell application "Finder"
    set List1 to {"VNG", "COW", "SIN", "CVR", "CRM"}
    set List2 to {"VNG", "SIN"}
    set MissingList to {}
    repeat with i from 1 to count of List1
    if item i of List1 is not in List2 then
    set end of MissingList to item i of List1
    end if
    end repeat
    display dialog MissingList as text
    end tell
    end adding folder items to
    Attach it to the folder, try - the answer comes as ""COWCVRCRM", without separating items in a list.
    Why?
    And, BTW, when I work with script I can see an Event Log in a Script Editor, but when Folder Action works - is there any way to see a Log?
    Thank you in advance for any help!
    Vera

    It may be that displaying the dialog via Script Editor instead of whatever app is frontmost when your folder action is triggered causes the difference. It's been known to happen. Try this in place of your code to display the dialog (untested code).
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    margin: 0px;
    padding: 5px;
    border: 1px solid #FF0000;
    width: 720px;
    color: #000000;
    background-color: #ffff99;
    overflow: auto;">
    set {oldDelims, my text item delimiters} to {my text item delimiters, {", "}}
    display dialog (items of MissingList) as text
    set my text item delimiters to oldDelims</pre>
    As for seeing your events, you can write code that can send some of it to a file on the desktop but you won't get all of it, mostly just error info. The best way I know of is to use [Script Debugger|http://www.latenightsw.com/sd4/index.html|http://www.latenightsw.com/s d4/index.html] from Late Night Software Ltd. It may seem expensive initially but it's worth every penny you'll spend on it. Note: the SD download is completely functional for 20 days after installation so you can give it a good workout. Its debugging environment will allow you to step through every line of code, see your variable results for each line and also concurrently view the event log.

  • Will changing the partition of the Home Folder automatically move files from old location?

    I want to change the home folder for my users.  Currently they are saving to the C: drive and using up the space on the root drive.  There is a D:  partition that has 774 GB free, so I would like to move use directories over to a new Home
    Folder on the D: drive. 
    http://support.microsoft.com/kb/816313
    What I am unsure of is whether or not I will have to manually move their files once I change the home directory.  Will it or do I need to take an extra step to move files in order to provide a seemless experience to the users?
    I am working with Windows Small Business Server 2011 Essentials.  

    Hi,
    Did you use the group policy to set the user home folder?
    As Ahmed MALEK mentioned, a user account is moved from one location to another in AD the users home drive setting is not automatically updated as its a static configuration on the users account. You need to manually move the file to the new location.
    Maybe you could consider the folder redirection, more detail information, please refer to:
    How to “Set users home folder” via group policy in Windows 8
    Regards.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Help with importing .mov file from iphoto

    I have a casio exilim ex-z1080 digital camera. I have imported the jpg and mov files into iphoto, but can't seem to get it to import into imovie. i read a similar post to mine but could not understand. can anyone help in lay person's terms?
    how do i get imovie to recognize the file?

    What do you think is the best program to do this? is it QuickTime?
    You can use MPEG Streamclip (free), GarageBand (part of iLife), or QT Pro ($30). Each will allow you to convert to any of the iMovie '08 compatible compression formats. (Just avoid Apple Animation and Apple Video which import and edit but do not export properly.) For simplicity, I would normally use use MPEG and convert to DV. This work flow produces a file that can be handled by almost any video editor and, since the format is very standardized, leaves few settings for the use to enter. All you really ned do is select the "Export to DV" File menu option, select any of the compression pop-ups (default DV25 is okay), enter your standard (NTSC or PAL), and set your aspect ratio (either 4:3 or 16:9). It is also a good habit to resample the audio to 48 Khz for consistency. Other that that, you can generally ignore the other settings. (You can also make adjustments to volume, brightness, contrast, and saturation as part of the conversion, but this isn't necessary if you are going to edit in iMovie '08 anyway.) The nice thing about this application is that it sets the anamorphic flag as part of your conversion which iMovie '08 uses in conjunction with the project properties to properly preview (or pad for preview when aspect of project does not match aspect of source file) and to set proper export dimensions (padded or otherwise) for the project aspect ratio output.

  • Help...Move files without changing "date modified"?

    I need to move files over from my old dead g4's hard drive to my intel mac book pro - but without altering the "date modified" in my documents and folders. I've pulled them over once, but all the files get tagged with the modification date I pull them onto the new hard drive.
    Are there any utilities or software or tricks to do this?
    Any help or direction will be appreciated.

    Robert Stover wrote:
    When you say <source> is that just the name of the hardrive I'm pulling from "New 250" or is the down to the file level... <New 250>users>documents>tcpa-report.doc>
    Terminal requires complete file paths in the UNIX style, using slashes between parts of the path. The root of all paths for files on mounted volumes is "Volumes" but if that is omitted the path defaults to the startup volume. Spaces separate command parts, so you must also "escape" spaces that appear in path names or they will be interpreted as command part separators. To escape a character, either precede it with a backslash ("") or enclose the entire part of the path in quotes.
    So, assuming "New 250" is not the startup (boot) volume, the UNIX style path to "tcpa-report" would be:
    /Volumes/New 250/Users/Documents/tcpa-report.doc
    If "New 250" is the boot drive, you could also use:
    /Users/Documents/tcpa-report.doc
    Fortunately, you don't have to remember any of this if you use the drag & drop capabilities of Terminal. Type the command up to the place where you need to enter a path (including typing the space just before it). Then drag the item whose path you need from the Finder into the Terminal window & drop it there. The path will automatically be formatted, including any escaping needed.
    If you need to follow one path with another, just type the single space that must separate them & drag the other file path into the window. Obviously, if the second path doesn't exist yet, you can't do this but you can drag the enclosing item into the window & type the final part of the path yourself. You can also use copy & paste within Terminal: copy by dragging across text with the pointer to highlight it, copy, then paste at the cursor.

  • Help- Importing DV movie file into FCP how do I change my FCP settings

    I am importing 5 different dv movie files that are approx 114.1mb each into Final Cut Pro. I opened a new project.. imported the files. Now I want to start putting together my sequence, but I need to change some settings, and I don't know where to start.
    When I go to insert the portion of one of the files into the sequence I get a popup saying
    "Attention- This clip does not match the sequence's settings or any of your sequence presets.
    For best performance your sequence and External Video should be set to the format of the clips you are editing.
    Change sequence settings to match the clip settings?"
    (No) (Yes)
    I obviously need to select yes.. but then i'm not sure what to choose after that.
    Could someone guide me please?
    Thank you

    They are .dv (person who sent them to me used imovie to upload their video they shot)
    So I need to open them in compressor and find the preset to convert them to dv quicktimes.
    Once they are dv quicktimes and I import them into my new project. Should I be good to go?
    Sorry for the novice questions... I do appreciate your help.

  • Help: Working with .MOV files in FCP and forced to RENDER FOR EVERY EDIT

    I'm working with .MOV files from my digital camera in Final Cut Pro and every time I make a new edit, I have to render it in order to see it in the canvas.
    How do I make it so that I don't have to render every edit in order to see it?
    (I've worked with files straight from a DV camera, and editing went fine. I'm assuming it has to do with the .MOV files)

    DV Cameras are not the same thing as a Digital camera. Digital cameras offer video on a limited basis and it's usually highly compressed in a non-editing format such as MPEG-2 or similar. NLEs are made to work with video cameras, not still cameras which is why you're having trouble.
    That's not to say you can't edit video captured with a digital camera, but you need to know how to prep it for editing. Some digital cameras shoot at odd frame rates and they all use some form of compression that is not typically used in editing. This means that you'll likely need to convert your clips to an editable format first using Compressor.
    Andy

  • Need help for playing .mov file in  a swing window......

    Am a B.Tech final yr student and my project output is an mov file... i need to play it in a swing jFrame... Can anyone guide me for the above????

    Hi.... I tried the code after changing but now am getting a new exception
    - create processor for the image datasource ...
    Setting the track format to: RGB, 24-bit, Masks=3:2:1, PixelStride=-1, LineStrid
    e=-1, Flipped
    - create DataSink for: file:/c:/1.avi
    start processing...
    - reading image file: C:\Program Files\Java\jdk1.6.0_12\bin\class1\1.jpg
    read 1832 bytes.
    # An unexpected error has been detected by Java Runtime Environment:
    # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x044c2890, pid=2052, tid=1200
    # Java VM: Java HotSpot(TM) Client VM (11.2-b01 mixed mode, sharing windows-x86)
    # Problematic frame:
    # C [jmjpeg.dll+0x12890]
    # An error report file with more information is saved as:
    # C:\Program Files\Java\jdk1.6.0_12\bin\hs_err_pid2052.log
    # If you would like to submit a bug report, please visit:
    # http://java.sun.com/webapps/bugreport/crash.jsp
    # The crash happened outside the Java Virtual Machine in native code.
    # See problematic frame for where to report the bug.
    Whats the problem now????
    Can u guide me????

  • Locked Windows/Folder, Cannot Move Files On External Hard Drive

    I'm running Tiger 10.4.11 on an iMac and am the only user, and therefore, administrator. I'm encountering a weird, albeit small, problem on one of my external hard drives (Seagate 320 gigs): I have boatloads of video files stored on the drive, but suddenly cannot move files into folders within the drive (I see a white "do not enter" kind of a sign over whatever icon I try to move). I can't move these files off the drive and onto my iMac's internal hard drive, either. I can only delete them. I can add new files to the drive, but then cannot move those either (can only delete them).
    The folders and drive are not locked, I have read & write access, etc., so there doesn't seem to be any reason for me to be barred from moving items. Any clues? Many thanks.

    Thank you for your reply and kind welcome.
    That's a great tip, but that box was already checked, so I'm afraid that wasn't a solution. The problem ended up "solving itself" after I left my machine off for the day while I went to work. I may never know why that error occurred, but I certainly don't care, as long as it doesn't happen again. Take care.

  • Create folder and move files to specific directory in AL11

    My requirement is to create a new folder in one of the existing directories in AL11 and move some files into it.
    I searched the forum and found this solution but it creates folder only in DIR_HOME directory.
    data: unixcom like rlgrap-filename.
    data: begin of tabl occurs 500,
    line(400),
    end of tabl.
    unixcom = 'mkdir mydir'. "command to create dir
    "to execute the unix command
    call 'SYSTEM' id 'COMMAND' field unixcom
    id 'TAB' field tabl[].
    I want the folder to be created in some other directory DIR_INTERFACES .
    Any suggestions are welcome ..

    Get complete path (physical path) using FM FILE_GET_NAME_USING_PATH.
    Default directory is DIR_HOME, hence it creates file in that directory...If you specify complete folder name, it will be created under that path..
    Concatenate mkdir
    space
    <physical path>
    mydir
    into unixcom.

Maybe you are looking for

  • Problem with nokia maps N95 8Gb

    I've been trying to use the GPS navigation trough NOKIA MAPS but it doesn't work, in my phone's screen appears "the license has expired" or something like that. I'd like to know what i've to do to make it work.  Because Iv'e heard that tthe GPS navig

  • A question about authorization of "me29n".

    I have a question about authorization of "me29n". In the screen of me29n, after I choose "cancel release" option,  there are several button I can use, such as "delete","lock","unlock" and so on.    now I want the "delete" button become unavailable af

  • JFrame display problem

    Hi All, My JFrame has 3 big tables and few label and text fields. It clips some rows in table while displaying and if I use maximun resulution then it displays properly. Is it because of the layout I am using or because og the big size of the table?

  • Computer doesn't detect iPhone

    I have a 1st gen iPhone and when I plug it into my computer, it doesn't detect it. I know the USB works because the phone is charging. What can I do to get my computer to recognize the device? I am using a desktop Mac with OS 10.5.7 and iTunes is v 8

  • Another case of phone in recovery mode after ios6 install

    I see that many others are having the same problem. What do I do to fix it? I get the picture telling me to connect to itunes and when I do I'm told that the phone is in recovery mode and must be restored. itunes is currently downloading the ios 6 so