title: Applescript: Need Help Resolving - Can't Get every file of said folder?
body: <p>With the help of some users on this form I was able to create this script below which lets you choose a folder then choose which folders within the folder you want to rsync into a OneDrive Backup Folder.</p>
  
  <p>Basically were migrating from a on site network storage to OneDrive for Business and want to create a script that as easy as possible for our users.</p>
  
  <p>The issue I have is I dont want the users to be able to choose the original folder, I want to set the variable up front.</p>
  
  <p>In the script I use:</p>
  
  <pre><code>set theFolder to (choose folder with prompt "Please Choose The Root of Your H Drive Or The Folder That Looks Like:    " &amp; userName &amp; "$")
  </code></pre>
  
  <p>If I use:</p>
  
  <pre><code>set theFolder to "/Volumes/MYERSMI5$/"
  </code></pre>
  
  <p>I get "Can't Get every file of said folder" error message.</p>
  
  <p>How Do I set the <code>theFolder</code> for this script ahead of time instead of asking the user to pick the folder?</p>
  
  <pre><code>set OuserName to do shell script "whoami"
  set userName to do shell script "echo " &amp; OuserName &amp; " | tr a-z A-Z"
  
  tell application "Finder"
     if not (disk userName exists) then
         mount volume "SMB Server/" &amp; userName &amp; "$"
     end if
  
   delay 2
  
     set theDialogText to "
         - Mac H-Drive Migration Tool -
  
  This Application Will Migrate a Copy of Your H Drive Data
  to your OneDrive for Buisness Folder Locally on Your Mac
  
  Migration Backup Location: 
  /Users/" &amp; OuserName &amp; "/OneDrive Folder/H-Drive Migration Backup
  
  ** Important **    
  In the Next Window Please Choose 
  The Root Folder of Your H Drive
  The Drive Label Should Look Like:    " &amp; userName &amp; "$"
  
     display dialog theDialogText
  
     set theFolder to (choose folder with prompt "Please Choose The Root of Your H Drive Or The Folder That Looks Like:    " &amp; userName &amp; "$")  
  
     do shell script "mkdir -p ~/'OneDrive Folder'/'H-Drive Migration Backup'"
  
     set HDriveBackupFolder to ((path to home folder as text) &amp; "OneDrive Folder:H-Drive Migration Backup")
  
     set AppName to "OneDrive.app"
  
     tell application "Finder" to set Answer_ to exists application file ((path to applications folder as string) &amp; AppName)
     if Answer_ is false then
  
         beep
         beep
         beep
         beep
         beep
  
     end if
  
     delay 1.5
  
     tell application "Finder"
         activate
         set theFolderNames to name of folders of theFolder
         set theChosenNames to (choose from list theFolderNames with prompt "Choose Which Folders to Backup, Please Hold Down The ⌘ Key To Choose Multiple Folders " with multiple selections allowed)
         if (theChosenNames is false) then return
  
         set HDriveBackupFolder to ((path to home folder as text) &amp; "OneDrive Folder:H-Drive Migration Backup")
     end tell
  
     repeat with thisName in theChosenNames
  
         tell application "Terminal"
  
             do script ("rsync -avpz --delete " &amp; (quoted form of POSIX path of ((theFolder as text) &amp; thisName)) &amp; space &amp; (quoted form of POSIX path of HDriveBackupFolder)
  
         end tell
     end repeat
  end tell
  </code></pre>