macOS: How to Access iCloud Drive in Terminal
OSXDaily has a great tip on how to access iCloud Drive in Terminal. If you prefer the Terminal over the GUI, or just want a different way to create and move files and folders, this is the tip for you.
[macOS: Use Clipboard in Terminal Without a Mouse]
iCloud Drive in Terminal
First, we’ll need to know the file path of iCloud Drive:
/Library/Mobile\ Documents/com apple CloudDocs/
Now, to navigate to iCloud Drive, we’ll be using the CD command, like so:

Changing directories
cd /Library/Mobile\ Documents/com apple CloudDocs/
You can use the command “ls” to get a list of the folders in each directory.
Copy Files
Now in order to copy files to iCloud Drive, you can use the “cp” command:
cp /Desktop/filename.zip /Library/Mobile\ Documents/com apple CloudDocs/
If you’ve already navigated to iCloud Drive, you’ll have to change directories to copy files. That’s what the CD command is. So before you copy a file to iCloud Drive, move back to your user directory:
cd /Users/USERNAME
Then you can copy a file with the previous command. It’s a bit confusing if you’re not used to Terminal.
Page 2: Copying and Moving Files and Folders
Page 2 – Copying and Moving Files and Folders
Copy Folders
Copying a folder (a.k.a. a directory) is similar to the copy file command, except we need to add the -a option:
Related
cp -a /Desktop/foldername /Library/Mobile\ Documents/com apple CloudDocs/

Copying a folder/directory
Moving Files and Folders
Instead of copying, you can move a file to change its location:
mv /Desktop/filename.zip /Library/Mobile\ Documents/com apple CloudDocs/
This command works for both files and folders.
[macOS: How to Find Network Devices Using Terminal]
0 Response to "macOS: How to Access iCloud Drive in Terminal"
Post a Comment