Copying files to app folders in iCloud Drive

Trying to automate some audio queueing.

I have a few folders with audio I want to make incremental daily progress on. I have a script that can pop the next audio out of each of those folders and copy it, but for some reason I can’t copy it to my Castro sideloads folder in iCloud drive.

Literally, I’m in Terminal, and I can’t see the folder I’m looking for in iCloud Drive.

It appears there might be some security restriction that’s preventing me from accessing the folder, as I just ran into a similar issue with PathFinder.

I added Terminal to “Full Disk Access” in Security & Privacy, and still no luck.

Is there some reasonable way to handle this?

I think you should be able to do so. What scripting language are you using?

I have an AppleScript that runs every 45 minutes and it downloads weather information and stores it to the Shortcuts folder on the iCloud drive, so my devices can use this information. I’m also able to copy files in Terminal to the folder of an iOS application.

Are you using the correct path when copying? Right click while pressing the option (⌥) key on the Castro sideloads folder, then you see an option to copy the path of the folder. Use this path in your script, as this path contain spaces (because it is in /Users/xxxxx/Library/Mobile Documents) you must use quotes or escape the path in your script.

If I go here in Terminal:

/Users/robertwall/Library/Mobile Documents/com~apple~CloudDocs

I see far fewer items than what I see in Finder. 25 in Terminal, 42 in Finder. And one of the 17 that’s missing is the app folder I need to access.

If I try to ‘cd’ to the folder by name, it tells me “No such file or directory”.

It’s bizarre. Hence the post here. :slight_smile:

Have you tried typing cd then dragging the folder into Terminal? It’ll fill the path for you.

1 Like

AHA! (And a brief “smacking my head” for not thinking of that!)

Turns out that Castro’s folder isn’t in com~apple~CloudDocs. It’s:

/Users/robertwall/Library/Mobile\ Documents/iCloud~co~supertop~castro/Documents

So that iCloud folder must get automagically parsed, en toto, and turned into the
Finder’s “iCloud Drive” view - even though that view doesn’t represent the actual reality of the filesystem on the disk.

Very, very interesting. Thanks Rose!

1 Like

Hi Frank,

I’m struggling to get ScriptEditor to save a file to the Shortcuts folder on iCloud. I see you’ve done it, would you mind sharing the section of code you use to do this when saving your weather data?

Thanks,
Sandy