如何在兩個伺服器之間傳輸檔案或者資料夾?(埠相同與不同的情況)
阿新 • • 發佈:2019-01-03
1、從本機傳輸檔案到另外一個伺服器:
scp -P 8122 /home/helpteach/project/mallupload/1509681299449.png [email protected]:/home/test
ps:-P 8122指的是接受檔案的伺服器的埠號,如果兩臺伺服器的埠號相同,則可省略該引數。
2、從本機傳輸資料夾到另外一個伺服器:
scp -r /home/helpteach/project/mallupload/ [email protected]:/home/test
3、從本機傳輸資料夾下面的所有檔案到另外一個伺服器:
scp /home/helpteach/project/mallupload/* [email protected]:/home/test
4、對拷貝過去的檔案重新命名:
scp /home/helpteach/project/mallupload/1509681299449.png [email protected]:/home/test/test.png
5、命令詳解:
/home/helpteach/project/mallupload/1509681299449.png:要傳輸的檔案
wasadmin:目標伺服器ssh賬號名
@後面:目標伺服器的IP地址
:後面:要傳輸到目標伺服器的檔案儲存目錄