Skip to main content
2 of 5
added 4 characters in body

I found a workaround to backup files on a removable hard disk to the OneDrive cloud.

  1. The OneDrive folder is in the default location on the system disk.
  2. I created a folder 'CloudBackup' within the OneDrive folder
  3. Use rsync to backup the folder 'THISFOLDER' on the external disk 'HD_Data' to the OneDrive folder.
  4. Use Applescript to run a shell script:

property tUSERNAME : short user name of (system info)

property tSOURCEFOLDER: "/Volumes/HD_Data/THISFOLDER/"

property tDESTFOLDER : "/Users/" & tUSERNAME & "/Library/CloudStorage/OneDrive-Personal/CloudBackup"

set tSCRIPT to "rsync -a --delete-after " & (quoted form of tSOURCEFOLDER) & " " & (quoted form of tDESTFOLDER) do shell script tSCRIPT

  1. Set the folder 'CloudBackup' to 'Free Up Space'. This tells OneDrive that after uploading to the cloud all files in the folder should not take up space on the system disk. This can be done manually in the Finder by right clicking on the folder and choose 'Free up Space' or with a script:

set tSCRIPT to "/Applications/OneDrive.App/Contents/MacOS/OneDrive /unpin /r ~/Library/CloudStorage/OneDrive-Personal/CloudBackup"
do shell script tSCRIPT