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

10,877

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
Share:
10,877
Parag Diwan
Author by

Parag Diwan

Updated on June 09, 2022

Comments

  • Parag Diwan
    Parag Diwan almost 2 years

    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?