場景: 將遠端linux上的 /home/work/test/file1.txt 下載到本地的user/test/downloads/
下面
首先 cd /home/work/test 到linux指定目錄
然后lcd user/test/downloads/ 定義本地目錄
get file1.txt
請問如果想指定下載后的檔案名字是file2.txt該怎么辦?
嘗試使用下面命令都失敗,下載成功但是檔案名字沒改變
get file1.txt file2.txt
get file1.txt -o file2.txt
同理如果get可以那么put(上傳)也可以指定上傳后的檔案名么?
求大神解答!
uj5u.com熱心網友回復:
man sftp:get [-afPpr] remote-path [local-path]
Retrieve the remote-path and store it on the local machine. If the local path name is not specified, it is given the same name it has on
the remote machine. remote-path may contain glob(3) characters and may match multiple files. If it does and local-path is specified, then
local-path must specify a directory.
If the -a flag is specified, then attempt to resume partial transfers of existing files. Note that resumption assumes that any partial copy
of the local file matches the remote copy. If the remote file contents differ from the partial local copy then the resultant file is likely
to be corrupt.
If the -f flag is specified, then fsync(2) will be called after the file transfer has completed to flush the file to disk.
If either the -P or -p flag is specified, then full file permissions and access times are copied too.
If the -r flag is specified then directories will be copied recursively. Note that sftp does not follow symbolic links when performing
recursive transfers.
----------------
put [-afPpr] local-path [remote-path]
Upload local-path and store it on the remote machine. If the remote path name is not specified, it is given the same name it has on the
local machine. local-path may contain glob(3) characters and may match multiple files. If it does and remote-path is specified, then
remote-path must specify a directory.
If the -a flag is specified, then attempt to resume partial transfers of existing files. Note that resumption assumes that any partial copy
of the remote file matches the local copy. If the local file contents differ from the remote local copy then the resultant file is likely
to be corrupt.
If the -f flag is specified, then a request will be sent to the server to call fsync(2) after the file has been transferred. Note that this
is only supported by servers that implement the "[email protected]" extension.
If either the -P or -p flag is specified, then full file permissions and access times are copied too.
If the -r flag is specified then directories will be copied recursively. Note that sftp does not follow symbolic links when performing
recursive transfers.
uj5u.com熱心網友回復:
看起來不能指定檔案名,只能指定目錄;轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/46172.html
標籤:應用程序開發區
上一篇:Windows Installer 程式包有問題,此安裝需要的程式不能運行。請與您的支持人員或程式包開發商聯系”
下一篇:Hisat2分析報錯
