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

how to use automator to connect to a server and copy files to desktop?

How do I use automator to connect to a server and copy files to the desktop?


In the PC world it would be

"robocopy \\IP ADDRESS\Folder name /MIR "%UserProfile%\Desktop\Folder name" /E

PAUSE"

MacBook Pro (Retina, 13-inch,Early 2015)

Posted on Nov 8, 2018 1:43 PM

Reply

Similar questions

8 replies

Nov 8, 2018 8:03 PM in response to rccharles

I haven't tried it. Too much of a hassle to set up a windows share 😉😊.


Seems like you could use an automator script something like this. There are a bunch more finder actions that you can try.


User uploaded file


how to pick the server.


User uploaded file


you would enter something like this [notice the slashes have changed direction]:

smb://192.168.1.250/User/VSO/Desktop/FORMS

Nov 8, 2018 6:20 PM in response to richbfromoklahoma city

Do you want to know how this works, or do you want somebody to write the tool?


I’ve been assuming the former. Automator is a scripting tool. It’s one of many scripting tools present on macOS. Automator has a nice GUI, and can encapsulate all sorts of activities. One of the many activities that Automator can invoke is a bash shell script. One type of script, calling another. A PowerShell calling a DOS batch script, for a Windows analog.


Bash and a couple of other Unix shells are the command line interface for macOS.


These command line interfaces are what are active when you launch the Terminal.app window. Term8nal.app opens up access to the Unix underpinnings. It’s a more advanced version of the traditional DOS box on Windows, and much closer to what Windows 10 with Services for Linux installed can provide, or Windows with cygwin installed.


Windows uses the DOS box or PowerShell for similar activities a macOS user might use a shell script. It’s these DOS commands that you’re seeking to mimic here with either Automator or a shell script, too.


Windows didn’t have a lot of scripting capabilities when last I was using that platform, other than cygwin, with PowerShell and SfL being more recent additions. macOS, being a different approach, can have scripts written in bash or zsh or another command shell, or in Perl or Python or various other languages.


Here, I’d write a shell script and use that. That’s the analog to The Unix batch file approach, though I’m not trying to mess around with thr file mounts and the rest, and would just access the remote server through scp. I’m also assuming thr remote system supports ssh/scp/sftp, as most now do. Windows 10 has been integrating remote-access capabilities here.


Windows was never good at logging into other systems and HyperTerminal was kind of a mess, though that’s being updated. macOS extensive support for logging into the command line of other systems, usually by ssh. That is, you can issue commands on one system, then ssh info another, and issue commands there. This entirely independent of the GUI. The ssh tool also provides for file transfers, using scp and sftp. Which is what I’d use here.


Perl, Python and other available scripting choices can also work.


Some doc on invoking a shell script from Automator:

https://www.macosxautomation.com/automator/shellacaction/index.html


An Apple primer doc on shell scripting:

https://developer.apple.com/library/archive/documentation/OpenSource/Conceptual/ ShellScripting/Introduction/Introduction.html


A basic file copy:

https://www.podfeet.com/blog/tutorials-5/how-to-create-an-automator-script-to-ba ck-up-to-dropbox/


How to run a shell script from the GUI:

https://stackoverflow.com/questions/5125907/how-to-run-a-shell-script-in-os-x-by -double-clicking#5126052


If there’s no other reply here, I’ll scrounge up a little time tomorrow to write the code as a shell script and as an Automator script, as I’m away from the Mac right now, and (unfortunately) the ASC forum forum software is doing some really weird stuff with the text wrapping right now, too.

Nov 9, 2018 8:10 AM in response to richbfromoklahoma city

Okay; looking at this again.


Can you provide a little more detail about the file server you're connecting to? Which of the various sorts of network file-access protocols does this server support? SMB? AFP? ssh/scp/sftp? FTP? (What robocopy doc I've located so far doesn't clearly indicate the protocol used for remote access, nor how it authenticates the access.)


If you're not sure about that, which specific software and version is the server running?


Are you periodically running this copy? If so, how do you want to deal with existing files already in the target directory; in the Desktop folder, in the robocopy example provided? Stop? Supersede? Ignore? Replace? It looks like—if I understand the robocopy syntax, which is not at all certain—you're looking to mirror the files. And it looks like the mirroring syntax of the robocopy command will clobber any extraneous files on the desktop.


Apple offers desktop mirroring with iCloud, too. https://support.apple.com/en-us/HT206985


In addition to or as an alternative to the scp I've mentioned earlier and to iCloud desktop, the rsync command may be useful here and particularly if you're mirroring files, depending on what you're up to.


And yet another approach is to use source code control for this stuff, and check in and check out copies of the files. git and mercurial are common choices here, and there are others. This if that remote server you're working with is a repository.

Nov 8, 2018 4:58 PM in response to richbfromoklahoma city

I’d probably use scp or sftp and a shell script, if sftp (ssh) is enabled on the target system. Wrap that in an automator job, if that’s what you’re domfortable with. Or run the shell script directly.


scp remote.example.com:/path/to/file /path/to/local/file


In this case


scp remote.example.com:/path/to/file /Users/{shortname}/Desktop/subfolder


A similar command is one of the easier ways to copy files around on recent Windows, with Services for Linux, or in earlier releases with various add-on tools.

OpenSSH in Windows 10! – Windows Command Line Tools For Developers


Here are some older automator scripts for scp, and some related materials...

https://github.com/dstebila/automator-scp

https://n8henrie.com/2013/01/automator-shell-script-uploading-images-to-wordpres s-server/

applescript - Trouble using ssh in a Mac Automator Service - Stack Overflow

http://www.bananica.com/Geek-Stuff/Synchronize-two-folders-on-a-Mac-with-Automat or-and-Rsync/


And as mentioned in one of the replies above, generate a certificate key pair, and you won’t have to embed a password in any of this. Place the public key on the far end of the connection from where the scp is running, and the private key on the local system. Here’s a writeup, and this stuff works the same for macOS ssh, scp and sftp...

https://www.digitalocean.com/docs/droplets/how-to/add-ssh-keys/create-with-opens sh/


And as a left-field alternative, CCC can schedule all sorts of transfers:

Features | Carbon Copy Cloner | Bombich Software


Also Panic Transmit, and which is scriptable:

https://www.panic.com/transmit/

amazon s3 - How can I get a list of files from a server with Transmit? - Stack Overflow

Nov 8, 2018 5:43 PM in response to richbfromoklahoma city

I appreciate the info but I don’t quite understand it.


I am trying to change this windows ( .bat) file into something that would run on an apple system. That is why I thought of the Automator.


The bat file is: robocopy \\192.168.1.250\User\VSO\Desktop\FORMS /MIR “%UserProfile%\Desktop\Veterans” /Z

PAUSE


Can this be done in Automator so I can put an icon on the desktop?

Nov 8, 2018 7:53 PM in response to richbfromoklahoma city

1) you need to gain access to the windows share. You use the mount command from the terminal or use the finder to mount.


use the finder.

How To Connect To A Windows Shared Folder On A Mac - YouTube


another example:

to connect to windows, you want to use smb:

Map a Network Drive in OS X (Mac) Permanently - YouTube



The first thing you need to figure out is the mac version of robocopy. You use the terminal [unix] cp command.


See this page.

https://becomethesolution.com/blogs/mac/robocopy-robust-for-mac-os-x-cp-command- terminal


It's best to try out terminal commands before you write your script. Use finder to mount then try the cp command in terminal.


the cp may be something like

cp /Volumes/forms ~/Desktop


once you figure out the syntax for cp, there is a run terminal command in automator.


R

Nov 8, 2018 7:56 PM in response to richbfromoklahoma city

Have a look at CCC, then. There’s a free (trial) download of that, and there are ways to g et that to schedule transfers. That might be the fastest way for you to get what you want, and CCC is handy to have around for backups and for cloning of macOS storage.


Beyond your capabilities? I’ll let you in on a big secret: we all started out knowing nothing about any of this stuff, and we were lost and puzzled and sometimes frustrated, and we learned, and we got better at it.

how to use automator to connect to a server and copy files to desktop?

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