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.

Similar Messages

  • How to copy folder with files and subfolders within it  to another folder

    how to copy a folder with files and subfolders within it to another folder

    http://javaalmanac.com/egs/java.io/CopyDir.html?l=new

  • Copying folders and Subfolders with files using Promises WinJS

    Hi,
    I have app written in WinJS.
    I want to copy a particular folder along with its subfolders and their files. I am so far successful with copying folders. Below is the code for the same.
    app.CopyFolder = function (folder, destFolder) {
    var replace = Windows.Storage.CreationCollisionOption.replaceExisting;
    //console.log("create folder: " + folder.name);
    return destFolder.createFolderAsync(folder.name, replace).then(function (newdest) {
    return app.CopySubFolders(folder, newdest);
    app.CopySubFolders=function(folder, destFolder) {
    return folder.getFoldersAsync().then(function (folderlist) {
    return WinJS.Promise.join(folderlist.map(function (folder) {
    return app.CopyFolder(folder, destFolder);
    Now after I have copied all the folders I need to copy their respective files. The problem is I am stuck,I get the files copied but I want to proceed ahead after all the files are written to their respective folders. Below is the code for the same.
    app.copyAllFiles = function (fileList, destStorFolder) {
    console.log('copyFiles Start...');
    var promises = [];
    var fileCopied = 0;
    var collideOpt = Windows.Storage.CreationCollisionOption.replaceExisting;
    return WinJS.Promise.join(fileList.map(function (file) {
    return app.copySingleFile(file, destStorFolder);
    app.copySingleFile = function (fileObject, destFolder) {
    var promises = [];
    var fileCopied = 0;
    var path = destFolder.path + "\\" + fileObject.folderName;
    var collideOpt = Windows.Storage.CreationCollisionOption.replaceExisting;
    return Windows.Storage.StorageFolder.getFolderFromPathAsync(path).done(function (folderObjectOfLocalFolder) {
    return fileObject.fileObject.copyAsync(folderObjectOfLocalFolder, fileObject.fileName, collideOpt).then(function (fileObject) {
    console.log("copied single file:" + fileObject.name);
    The problem is when i run the folder copy code and apply breakpoint for the success call back of 
    CopySubFolders(source,destination).done(/*my breakpoint*/)
    The folders are created.
    But when I try to breakpoint for my copyAllFiles,the files are created only when i pass the success call back.
    Can anyone tell me what am i doing wrong? How can I proceed ahead only when all the files are written successfully.
    Regards,
    Ninad 

    Hi,
    I tried the above solution but what i want is that the action of copying folders and subfolders along with the files should be done with promises and that promise should return only when all folders,sunfolders and their files have been copied. I want to
    do it in this way because I want to perform certain second action only when all things are copied.
    If I do it the as per the link the function runs in the background and my second action proceed aheads and may cause error if it finds some folder or file missing.
    So I came up with following above code,first copy folders then copy. The copy folder works as expected but the files are getting copied only when the file copying code enters the success call back.
    Can you please shed light on my code where I am going wrong.
    Or is it ok to proceed ahead with the solution you mentioned at the link cause I dont want any runtime crashes.
    Regards,
    Ninad

  • Folder action to find and replace text and change line feeds

    I want to use a folder action to find and replace text and change Mac carriage returns to DOS line feeds inside text files.
    The text to be replaced is: "/Users/wim/Music/iTunes/iTunes Music/Music" (without the quotes)
    This text has to be removed (i.e. replaced by an empty string)
    The text occurs many times within each file.
    The files are playlists exported from iTunes in the M3U format (which are text files). They contain Mac carriage returns. These need to be changed to DOS line feeds.
    I have found the following two perl commands to achieve this:
    To find and replace text: perl -pi -w -e 's/THIS/THAT/g;' *.txt
    To change carriage returns to line feeds: perl -i -pe 's/\015/\015\012/g' mac-file
    I know that it's possible to make a folder action with Automator that executes a shell script.
    What I want to do is drop the exported playlists in M3U format in a folder so that the folder action will remove the right text and change the carriage returns.
    My questions are:
    Is it possible to make a folder action that executes command line commands instead of shell scripts?
    What is the correct syntax for the two commands when used in a folder action shell script? Especially, how do I escape the slashes (/) in the string to be removed?
    Thanks for your help

    Ok, I've include an applescript to run a shell command. The applesript command quoted form makes a string that will end up as a single string on the bash command line.  Depending on what you want to do, you may need multiple string on the bash command lines.  I've included some information on folder actions.
    It is easier to diagnose problems with debug information. I suggest adding log statements to your script to see what is going on.  Here is an example.
        Author: rccharles
        For testing, run in the Script Editor.
          1) Click on the Event Log tab to see the output from the log statement
          2) Click on Run
        For running shell commands see:
        http://developer.apple.com/mac/library/technotes/tn2002/tn2065.html
    on run
        -- Write a message into the event log.
        log "  --- Starting on " & ((current date) as string) & " --- "
        --  debug lines
        set desktopPath to (path to desktop) as string
        log "desktopPath = " & desktopPath
        set unixDesktopPath to POSIX path of desktopPath
        log "unixDesktopPath = " & unixDesktopPath
        set quotedUnixDesktopPath to quoted form of unixDesktopPath
        log "quoted form is " & quotedUnixDesktopPath
        try
            set fromUnix to do shell script "ls -l  " & quotedUnixDesktopPath
            display dialog "ls -l of " & quotedUnixDesktopPath & return & fromUnix
        on error errMsg
            log "ls -l error..." & errMsg
        end try
    end run
    How to set up a folder action.
    1) right click on folder. click on Enable folder actions
    2) Place script in
    /Library/Scripts/Folder Actions Scripts
    3) right click on folder. click on attach folder action
    pick your script.
    Create a new folder on the desktop & try.
    You can put multiple folder actions on a folder. There are other ways of doing this.
    Here is my test script:
    on adding folder items to this_folder after receiving dropped_items
        repeat with dropped_item_ref in dropped_items
           display dialog "dropped files is " & dropped_item_ref & " on folder " & this_folder
        end repeat
    end adding folder items to
    How to  make the text into an AppleScript program.
    Start the AppleScript Editor
    /Applications/AppleScript/Script Editor.app
    In Snow Leopard it's at: /Applications/Utilities/AppleScript Editor
    Copy the script text to the Applescript editor.
    Note: The ¬ is typed as option+return.  ption+return is the Applescript line continuation characters.
    You may need to retype these characters.
    Save the text to a file as an script and do not check any of the boxes below.

  • Error 7 occurred at Copy in ABAPI Dist New VI Library.vi​- ABAPI Dist Chk for Destinatio​ns.vi- ABA​PI Copy Files and Apply Settings.v​i- EBEP_In​voke_Build​_Engine.vi​- EBUIP_Bu​ild_Invoke​.vi- EBUIP​_Build_Inv​oke.vi.Pro​xyCaller

    When I try to build executables in LabView 8.01 I get message:
    Error 7 occurred at Copy in ABAPI Dist New VI Library.vi->ABAPI Dist Chk for Destinations.vi->ABAPI Copy Files and Apply Settings.vi->EBEP_Invoke_Build_Engine.vi->EBUIP_Bu​ild_Invoke.vi->EBUIP_Build_Invoke.vi.ProxyCaller
    Best Regards

    I got the same error as I tried to build my application, the reason was the string I set for the 'Build specification name' property of my build.
    I changed from '3DC - Dlog Data Compacter ' to '3DC' and it worked afterwards..quite strange behaviour..

  • Can you help me find pix that I stupidly made a new folder in temp files and now can't find my pictures?

    Can you help me find pix that I stupidly made a new folder in temp files and now can't find my pictures?

    Mac Pro
    Using a MacBook Pro    
    Two different computers.  One is a desktop & the latter is a Notebook.  Which one are you having issues with? 
    Which os is installed on your computer?
    Please describe in detail all you have attempted to do in order to resolve the issue.  How did you "search?"

  • Why does long list of files and subfolders scroll to top of finder window when a folder midway or down the list is opened?

    I am not sure how long ago this first occured, but when I upgraded to OS 10.8, I was hoping this would correct itself.  Now I am not sure if it is a bug or just the way Finder works.  When I have a Finder window with many files and folders, and I open a folder > midway through the list while previous files and/or folders have already scroll off the top of the window, the window scrolls up to the beginning of the list and I need to scoll back down to wee what is in the folder.
    I thought the finder window stayed steady and the folder openned revealing its contents without the finder window scrolling.  The only work around I have found for this is to always double-click a folder open, so it is the new Finder window.
    Problem or not?
    Thanks,
    Ray

      About the only thing I can say is to keep going to Verizon, or calling customer service to get them to look at the issues. I talked to 1 rep that told me to dial either 4# symbols, or 4* symbols (Can't remember which it was) after I got the VM message but did not have the phone ring, so it would mark my account record and they could search and troubleshoot the issue.
      As far as your upgrade, I think you have done the right thing so far, and that is signing up on this forum, that way you can look at the different phone forums and see what issues that people are having. Talking to people that have the phone is a great way to find out what the issues are. Verizon Sales reps will only sell you the latest and greatest, or if there is something that they are being told to push to get out of stock.
      Going with an iPhone is ok, just make sure it is correct for you, because like you said earlier, once it is done, it is done and you are stuck with it for 2 years. I had a friend who made a knee-jerk reaction to a bad phone, and did the same thing. They regretted it after 6 months. I am not saying the iPhone will be bad for you, just make sure you do your homework.

  • Create folder, copy file, and then register OCX via GPO

    I will try and explain this issue.
    I have a .bat (ocx_reg.bat) file with the following:
    echo off
    md c:\ocx
    xcopy \\server.contoso.com\install$\ocxfile.ocx c:\ocx /Y /D /E /K /I
    %systemroot%\syswow64\regsvr32 /s c:\ocx\ocxfile.ocx
    I have saved this .bat file in the %logonserver%\netlogon folder.
    I have then configured this in a GPO:
    GPO => Computer Configuration => Windows Settings => Scripts => Startup and added
    %logonserver%\netlogon\ocx_reg.bat as a Startup script.
    However when booting the computer and logging in with a domain user, the folder is not created, and so the OCX is not registered.
    I have run gpresult and it doesn't even show that I have configured anything under that particular section of the GPO.
    The user logged in is a member of the security group which this GPO is targeted for under Security Filtering.
    So I am not sure why this is happening.. 
    Any suggestions?
    Kthxbai

    Hi,
    Before going further, please make sure that the script itself can run successfully. Besides, for we are assigning the script as computer startup script, we need to make sure the computer accounts have access to the script. We can test this
    by accessing the script stored on the server from a client computer and run the script to see if it works.
    >>The user logged in is a member of the security group which this GPO is targeted for under Security Filtering.
    For we are applying computer settings, the computer accounts must have
    Read and Apply permissions to the GPO. We need to add computer accounts in question under Security Filtering. Otherwise, the GPO won't get applied to computers in question.
    >>I have run gpresult and it doesn't even show that I have configured anything under that particular section of the GPO.
    After making sure that the GPO is correctly linked and Security Filtering is set correctly. If the issue persists, we can run command
    gpresult/h c:\gpreport.html with administrative privileges to further check group policy result report. If necessary, you can upload the report to Onedrive and provide us the download link.
    In addition, regarding how to assign computer startup scripts, the following article can be referred to for more information.
    Create System Startup / Shutdown and User Logon / Logoff Scripts 
    http://technet.microsoft.com/en-us/magazine/dd630947.aspx
    TechNet Subscriber Support
    If you are TechNet Subscription user and have any feedback on our support quality, please send your feedback here.
    Best regards,
    Frank Shen

  • 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.

  • 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 action to package and create pdf Applescript folder action

    Hi
    Does anyone have an Applescript Folder Action to package Indesign CS5.5 files and make pdfs.
    Thanks, in advance.

    Hi Babs
    I ended up paying someone to create the script. They did a fantastic job creating a droplet that has options to package, create PDFs to presets, print to presets, create an IDML file, retrosave this to CS4 and create a thumbnail. Sounds like a lot but that is what I ended up needing for one client and I can use it on anything.
    Thanks
    Mac
    Sent from my iPhone

  • 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.

  • Moving or Copying Files and Folders on the Desktop.

    Hi All, I have come across this before and cannot recall how I got around it. I have copied some folders from an external FW drive onto the desktop of my iMac. I create a new folder on the desktop to move these folders into. Without holding down the option key or any key, the Finder copies them instead of what it should be doing by moving them. It is a pain!!! What is making the Finder copy rather than just move these folders even though they are on the same volume? The owner of the folders and the logged in user on the iMac is the same. Any suggestions appreciated. Thanks.

    Barbara, Sorry but I don't think you understand my issue.
    Let me clarify.....
    I have copied a folder from my External Firewire drive to my desktop.
    I have created a new folder on my desktop.
    When I attempt to move the copied folder which is already on the desktop to the new folder which is also on the desktop, a + sign appears on my cursor. I don't want to copy it to the new folder, I just want to move it into it. This is all happening on the same volume and happens only with the folder. Any files inside this folder can be moved as per normal.
    Hope this is clearer.....
    Message was edited by: Cobra5400
    Message was edited by: Cobra5400

  • 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.

  • How do I find a previous windows version. It's telling me to copy files and then delete old version.

    When I got on my laptop today, I saw that there was a message from HP Support Assistant. It says that I have an older versions of windows and that the previous versions of windows was saved in a folder c:\windows.old. it says that the folder is very large and it recommends me coping any old files I want to keep and then delete the Windows.old to free up more disk space. It has a help column that says, "How do I backup my files from Window.old? When I do what it tells me to do, I can't find it. Could someone please help me? Thanks you.
    Product Name: HP Pavilion g7 Notebook PC
    Product Number: B5R84UA#ABA
    O/Sis Microsoft Windows 7 Home Premium (64-Bit) SP 1
    Systems BIOSis F.14

    Hi,
    Looks like a new OS has been installed/re-installed. Do you want to keep Windows.old folder for just in case? Otherwise you can delete it using the following instructions:
       http://windows.microsoft.com/is-IS/windows7/How-do​-I-remove-the-Windows-old-folder
    Regards.
    BH
    **Click the KUDOS thumb up on the left to say 'Thanks'**
    Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem.

Maybe you are looking for