title: How do you copy a file to a folder with {name:"XXX-X-XXXX" & foo} in Applescript
body: <p>I have a script I need to write where I have created a folder with this script (below) but cant figure out how to copy a file to the created folder because how its named. </p>
  
  <pre><code>set foo to computer name of (system info)
  tell application "Finder"
      set home_path to home as Unicode text
      set targetFile to (home_path &amp; "Library:Logs:Xxxxx.log")
      set p to (path to desktop)
      try
      set targetPath to make new folder at p with properties **{name:"XXX-X-XXXX" &amp; foo}**
          duplicate file targetFile to targetPath
      end try
  end tell
  </code></pre>
  
  <p>I thought I could write a script like this. </p>
  
  <pre><code>set foo to computer name of (system info)
  
  
      tell application "Finder"
          set p to (path to desktop)
  
          set home_path to home as Unicode text
          set targetFile to (home_path &amp; "Library:Logs:Xxxxx.log")
          set p to (path to desktop)
          try
              set targetPath to p &amp; {name:"LOGS-I-NEED" &amp; foo}
              duplicate file targetFile to targetPath
          end try
          try
          on error the error_message number the error_number
              display dialog "Error: " &amp; the error_number &amp; ". " &amp; the error_message buttons {"OK"} default button 1
          end try
  
      end tell
  </code></pre>
  
  <p>But I get this error </p>
  
  <p>--> error number -1700 from {alias "Macintosh HD:Users:dorianglanville:Desktop:", "LOGS-I-NEEDDorian's MacBook"} to folder</p>
  
  <p>I feel like I'm missing something simple but have been staring at it so long I can no longer "see" it. </p>
  
  <p>Thanks Guys!</p>