how can I move some file to a folder on fileserver

Hi
I have some files and I want to move them onto the server, I do as this:


move file newfile into folder url "file:///servername/foldername"
newfile is on mac, server is windows.

but it always fails, what can I do? thanks a lot!

Comments

  • SenseTalkDougSenseTalkDoug ForumAdmin admin
    You can't really use a url there. The file system commands (copy file, move file, etc.) all expect to just be given the file name or path. So you can do:
    move file newfile into folder "/locallymountedservername/foldername"
    
    The trick for this to work is that you'll need to have the server mounted on the Mac's file system. Then you can treat remote files using a local path.
  • Hi,
    According to your advice, I first mount the server to my mac,
    So I do like this:

    set the shellCommand to "/bin/bash"
    shell("mount_smbfs //usr:[email protected]/folder /'share folder'/mntfolder ")

    I run mount_smbfs //usr:[email protected]/folder /'share folder'/mntfolder , it works well in terminal, but when I run with "shell" command, it fails,
    the result is 32.
    I don't know why, so strange.
  • JonathanOSXJonathanOSX ForumAdmin admin
    It definitely can work from a script, here are a few points to keep in mind.

    You may be confusing it with what's quoted and what's not, I recommend using variables.

    You need to recreate the directory each time (unmount deletes the local folder).

    My sample script:
    put "guest" into remoteUser
    put "" into remotePassword
    put "redstonel5/C" into remoteHost
    put "/Volumes/GPB" into localFolder
    
    create folder localFolder
    put "mount -t smbfs //" & remoteUser & ":" & remotePassword & "@" & remoteHost && localFolder into mountCommand
    put mountCommand
    shell(mountCommand)
    put the result
    
    put shell("ls -l" && localFolder)
    
    put shell("umount" && localFolder)
    
  • JonathanOSX

    Many thanks to you, It works.
Sign In or Register to comment.