How to copy file to Windows share (using command line) without asking for user's help, if possible at all?

6,667

I saw this

wrote this apple-script and its working (working from command line made me retype password for some reason - so I'm using the script).

try mount volume "smb://user:password@server/sharePath" end try

thank u all

in link they suggested also to add this to startup items so u won't have to run script every time u startup...

Share:
6,667

Related videos on Youtube

zook2005
Author by

zook2005

Updated on September 18, 2022

Comments

  • zook2005
    zook2005 over 1 year

    I need to copy a file from my OS X machine to a remote Windows share. Currently, I first use open and then cp -f myFileName /Volumes/TheRemoteShareName/myFileDestinationName.txt".

    Is there a way (using only command line) to copy the file without GUI? I tried mount_smbfs -W workgroup //user:password@SERVER/folder ./mntpoint as suggested here but it made me retype password for some reason - so it's not a good solution cause it demands user to act and Im looking for a fully automated solution.

    edit: i'm looking for a built in solution please... no extra installations. edit: this question was not properly formulated (now edited)

    • wendy.krieger
      wendy.krieger over 9 years
      Probably not. cp supposes the file system be mounted,
    • wendy.krieger
      wendy.krieger over 9 years
      I am an OS/2 user. Linux and apple are not my cup of tea, but i suspect that the file system must be open. You could write a shell script to do this, and run it on demand from a desktop icon.
  • zook2005
    zook2005 over 9 years
    thank you. that is a very good solution. however it creates Dependence in whether rsync is installed or not and i want a built in solution. im editing my question now...
  • BlueC
    BlueC over 9 years
    In that case, can you clarify what you mean by "without mounting the remote share first"? You need access to the remote filesystem so that will have to be either by mounting it or some third-party access mechanism. Would an acceptable solution be to have a script that checks if the volume is already mounted, if not then mount it, copy the file, then unmount it?
  • zook2005
    zook2005 over 9 years
    yes @BlueC. this is a great idea! as long as I don't have to use/see the GUI at all... i finally found this: link as a starting point. it's working!