Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Automatic moving of documents using Automator

I want to have a Folder Action or Service or whatever would be appropriate to have docs put into a Folder on my desktop automatically go to a folder in iCloud. I did a test of a Folder Action and it works inside Automator but not outside it. I don't want to have to run Automator, just want the docs moved to iCloud in a receiving folder from which I can handle them. Any suggestions?? I had hoped it would be a service and not need a special folder in which to place it, but couldn't get that done.


Mojave OS

iMac 27" 5K, macOS 10.14

Posted on Feb 29, 2020 10:37 AM

Reply

Similar questions

12 replies
Sort By: 

Feb 29, 2020 3:16 PM in response to Victoria Herring

This short Automator Folder Action script works for me in 10.13.6 High Sierra.

I start with a desktop folder named "Send to iCloud". Any files I drop into the folder are automatically sent to my iCloud storage.

The (To:) location specified in the Move Finder Items action was specified by dragging the iCloud Drive location from the Finder window sidebar.


I have no way to test in Mojave at this time, but I don't see why it should not work.


Reply

Feb 29, 2020 3:48 PM in response to Victoria Herring


Victoria,


The following will move files dropped on a Desktop drop folder to your iCloud Drive location. In this example, I have created an arbitrarily named new folder on iCloud Drive as Dropped. The Automator Folder Action will also pop a dialog box when done informing that it was done, and the count of files moved. Tested on Mojave 10.14.6 (18G3020), and on Catalina 10.15.3 (19D76). The folder action setup will already be completed when you save the Automator folder action.


#!/bin/zsh

# global counter variable
typeset -ig cnt=0

ICLOUD="${HOME}/Library/Mobile Documents/com~apple~CloudDocs/Dropped"

for f in "$@"
do
	# extract filename from full path of this drop folder
	OUT="${f:a:t}"

	# force (-f) overwrite, and construct drop folder path and filename as source for move
	/bin/mv -f "${f:a:h}/${OUT}" "${ICLOUD}/${OUT}"

	# count dropped files in drop folder, but not dot files
	$((cnt++))
done

/usr/bin/osascript -e "display dialog \"Drop operation complete\" & return & \"Files moved:  \" & \"$cnt\"  with title \"Folder Action Drop Status\""



So, In Automator, you create the folder action and aim it at the designated drop folder on your Desktop. You need a single action in your workflow which is Utilities : Run Shell Script, where you specify Shell: as /bin/zsh, and Pass input: as arguments. You replace the boilerplate content in that Run Shell Script action with the above zsh script code, and save the folder action. I called mine Drop to iCloud Folder.


When done:





Reply

Mar 4, 2020 2:18 PM in response to Victoria Herring

Well I was able to create a folder on my MacBook Pro and one on my iMac [different names on each machine and on iCloud] and for awhile the MBP one worked just fine [ie the contents but not folder move when they are added to the folder on the MBP desktop] but now when I drop something in it, it doesn't run and if I run it [in Automator - it's not running on its own] it moves the folder AND files to the recipient folder on iCloud - same thing as is happening on the iMac = the MBP one was working but not the iMac and now neither work = they both send folder and contents to the recipient folders on iCloud. Here's a pic of the workflow in Automator - which I copied to the iMac. The folder which went to iCloud is fine and contents are inside...but it is no longer on the desktop. I did a Folder Action setup and got the Service working and able to control the Finder - I'm perplexed, it was working on MBP and not on iMac, the Folder Action set up was the same for each and now the MBP doesn't work either and both of them move Folder and contents to the iCloud folder.




Reply

Feb 29, 2020 3:57 PM in response to VikingOSX

Whew! I'll take the time to digest this and implement it = I did create a folder action in Automator but while it worked inside A. it didn't once I tried it == I'll give this a go == I'm not much for script editor tho, which is why I use A. - I'll give it a go and many thanks!!!!

Reply

Mar 1, 2020 3:20 PM in response to Barney-15E

I'm going to save the whole thing but it's working now == in fact it's almost instantaneous == I drag something into the folder [it's on the desktop] and poof it goes into the folder in iCloud == I ran it and got a message about "Folderactionsdispatcher.app" needing to gain access to control the finder == I went to System Preferences and clicked that it could and now is working fine.


Many thanks to all of. you for great help --So much better than having to mess with opening a window and then iCloud!!!

Reply

Automatic moving of documents using Automator

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.