Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to copy files from Mac OS to Windows which are in same network using command line?

I know that , we can copy files from host to another from mac using finder/smb protocol.

But I would like to copy files from mac to windows machine using command line. so that, I can call the same pro-grammatically.

Could anyone please guide?

like image 989
Robin Avatar asked Jul 01 '13 19:07

Robin


People also ask

How do I transfer files from Mac to PC over network?

Set up file sharing on the MacSelect the File Sharing checkbox, then click Options. Select “Share files and folders using SMB.” In the Windows File Sharing list, select the checkbox next to the user account that will be used to share files with Windows users, enter the password for that user, then click OK.

How do I copy files from Mac to Windows Server?

In Remote Desktop , select a computer list in the sidebar of the main window, then select one or more computers. In the Finder, locate the item or items you want to copy, then drag the items from the Finder to the client's screen in the control window. Select your copy options, then click Copy.

Can I transfer files from Mac to Windows?

Transfer Files Using an External DriveAn external storage device (external hard drive or USB flash drive) can be used to copy data between your Mac and your new PC. For the broadest compatibility, you can format that drive with the exFAT* file system, which both macOS* and Windows* can write to.


1 Answers

If you can copy the files using the Finder then you have connected to the SMB share. Usually, you can see this from the command line by looking in the /Volumes folder; if it doesn't look like it's there, try running the mount command to see other places things might be connected. The following assumes the SMB is mounted in /Volumes, adjust as necessary for your particular case.

On the command line, issue the command:

ls /Volumes

You should see the SMB share listed along with some other names.

Then to copy files to it:

cp myfiles/* /Volumes/MySMBShare/mydirectory

If the name of the share has spaces in it you will need to escape them with backslashes like so:

cp myfiles/* /Volumes/My\ SMB\ Share/mydirectory
like image 142
Perry Avatar answered Oct 02 '22 10:10

Perry