Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8796799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:42:19+00:00 2026-06-13T23:42:19+00:00

I’ve been trying to get System Events to duplicate files in AppleScript and I’ve

  • 0

I’ve been trying to get System Events to duplicate files in AppleScript and I’ve been failing 🙂 I eventually always get the error “error “Files can not be copied.” number -1717″. So I changed my tactics and tried using the Finder to make sure what i was trying to do was correct. Here is the code that works:

tell application “System Events”

set desktopFolder to (path to desktop folder) as string
set fullPath to desktopFolder & "Temp Export From DO"

set theDOEntries to every file of folder "/Users/jkratz/Dropbox/Apps/Day One/Journal.dayone/entries" whose name extension is "doentry"
repeat with DOEntry in theDOEntries
    set source to path of DOEntry
    log "Source file: " & source
    set destination to fullPath as string
    log "Destination folder: " & destination
    tell application "Finder"
        duplicate file source to folder destination with replacing
    end tell
end repeat

end tell

If I remove that last tell, so that it uses System Events, I get the same error noted above. The dictionary for System Events standard suite has a “duplicate” command so I’m not sure what is going on here. Also, “Learning AppleScript, 3rd ed” from APress notes:

“One particularly annoying omission in System Events is that it can’t yet duplicate files and folders; if you need to do this, the Finder is your best bet.”

The 3rd edition is from 2010. It would seem that even in Mountain Lion this is still true. Can anyone confirm this? The 1717 error number lists everywhere else as a handler error and i’m not using handlers.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T23:42:20+00:00Added an answer on June 13, 2026 at 11:42 pm

    Try:

    tell application "Finder" to set desktopFolder to (path to desktop folder as text) & "Temp Export From DO" as alias
    tell application "System Events" to set theDOEntries to every file of folder "/Users/jkratz/Dropbox/Apps/Day One/Journal.dayone/entries" whose name extension is "doentry"
    repeat with DOEntry in theDOEntries
        log "Source file: " & DOEntry
        log "Destination folder: " & desktopFolder
        tell application "Finder" to duplicate file DOEntry to desktopFolder with replacing
    end repeat
    

    If you don’t need to log the values you can simply:

    tell application "Finder" to set desktopFolder to (path to desktop folder as text) & "Temp Export From DO" as alias
    tell application "System Events" to set theDOEntries to every file of folder "/Users/jkratz/Dropbox/Apps/Day One/Journal.dayone/entries" whose name extension is "doentry"
    tell application "Finder" to duplicate theDOEntries to desktopFolder with replacing
    

    Or:

    set desktopFolder to quoted form of (POSIX path of (path to desktop folder as text) & "Temp Export From DO")
    do shell script "find '/Users/jkratz/Dropbox/Apps/Day One/Journal.dayone/entries' -name \"*.doentry\" -type f -print0 | xargs -0 -I {} cp -a {} " & desktopFolder
    

    Getting back to your question, the duplicate commands creates duplicates of Finder items. You can use System Events to duplicate Finder items like this:

    tell application "Finder"
        set myFile to file ((path to desktop as text) & "Test File.txt")
        set myFolder to folder ((path to desktop as text) & "Test Folder")
    end tell
    
    tell application "System Events"
        duplicate myFile to myFolder
    end tell
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am trying to render a haml file in a javascript response like so:
This could be a duplicate question, but I have no idea what search terms
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to select an H1 element which is the second-child in its group
Does anyone know how can I replace this 2 symbol below from the string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.