tar cvfz Command Not Writing to iCloud Drive Folder – Fix

command lineicloudsymlinktarterminal

I am trying to link up (create a copy) of a folder in the User's Libraryinto the iCloud Drive folder, so that it will be synchronised across computers should I need to change machine. For your knowledge, this folder contains app settings that are not easily accessible if I had to do a format or system reset.

Operating the tar cvfz command on the Users/< username >/Mobile\ Documentsfolder does perform some action in Terminalbut it doesn't actually create any copy of the desired folder.

To test if I was doing something wrong I changed the destination folder to the Downloadsfolder and, magic, it worked.
Have I to assume that one doesn't have permissions to write to the iCloud Drive directory from the Terminal?

All of this is being attempted on a 2016 15" MacBook Pro with macOS 10.12.6.

Best Answer

You need to place the file in this folder instead:

~/Library/Mobile\ Documents/com~apple~CloudDocs

This is where you can place generic files, similar to saving them in "iCloud Drive" in the Finder.

Also you seem to have the order of arguments to tar wrong, so that you're really creating a file named "z" instead of "Avid_Backup.tgz" that you thought you were saving to.

The commands thus needs to be:

  tar -cvzf "~/Library/Mobile\ Documents/com~apple~CloudDocs/Avid_Backup.tgz" "~/Library/Application\ Support/Avid/Sibelius"