title: Zip a folder using apple script
body: <p>I am attempting to use applescript to copy a folder to my desktop, zip it, then move the .zip file elsewhere but I can't get the zipping part to work.</p>
  
  <p>I've looked everywhere for ways to zip a file/folder in applescript and I don't know what I'm doing wrong but none of them have worked for me.</p>
  
  <p>I would also rather not have to choose the folder after it's been copied and the folder after it's been zipped but I thought I'd leave them till the zipping is fixed.</p>
  
  <p>Any help at all would be greatly appreciated.</p>
  
  <p>This is my code: <strong>(updated after help from <em>djbazziewazzie</em>)</strong></p>
  
  <pre><code>set workspace to (path to desktop as text) --"Users:produser:Desktop"
  
  tell application "Finder"
  
  display dialog "Select a folder to be zipped"
  set inputFolder to choose folder
  set inputFolderProperties to properties of inputFolder
  set inputFolderName to name of inputFolder
  
  duplicate inputFolder to workspace with properties --copy input folder to workspace
  {name:inputFolderName} --keep the same name
  
  --set copiedFile to (workspace &amp; inputFolderName) 
  display dialog "Select the folders desktop copy"
  set copiedFile to choose folder --select the file copy thats on the workspace
  
  tell current application
      set qpp to quoted form of POSIX path of copiedFile
      do shell script "zip -r " &amp; qpp &amp; ".zip " &amp; qpp -- zips the file (or not...)
  end tell
  
  display dialog "Select the .zip file" --select the new .zip file
  set zipFile to choose file
  display dialog "Select the output folder"
  set outputFolder to choose folder --moves zipped file
  move zipFile to outputFolder
  
  end tell   
  </code></pre>