#!/bin/bash
"mirror -R //thevault/Shared/Operations/Marketing/test --only-missing -e ;exit"
I'm using lftp to mirror a folder on a share drive. But it fails with "No such file or d开发者_运维问答irectory" What's the correct way to write this? and How would I escape a space in the file name. I've tried literally everything.
I've also tried /cygdrive/s/Operations/Marketing/test
. This works while I'm logged in and I run the script. But when the task is run while I'm not logged in the log file I get the same "No such file" Error.
I don't think that is support in general in cygwin for UNC pathnames (ie \\server\share
) so you'll have to rely on mapping to a network drive and then using /cygdrive/s
. To fix the problem with it not working when you aren't logged in, you'll need to call the Windows NET
program from your script:
net use s: \\thevault\Shared password /user:myuser
There may be some security implications to having the password in plaintext, so another possibility is to ensure that the script is running from a user account that has read permission to this server, and then you can omit the password.
This seems to be working perfectly while logged out.
#!/bin/bash
lftp ftp://username:password@server.com -e "mirror -R //thevault/Share/folder/folder/folder\ with\ spaces/folder/folder --only-missing -e;exit"
It was the escaped spaces in my path. The reason that this didn't work is because when I retyped the path I misspelled share. //thevault/shared <~~ incorrect
#!/bin/bash
"mirror -R //thevault/Shared/folder/folder/test --only-missing -e ;exit"
精彩评论