问题
I need to copy a file from windows to UNIX to a specific folder and set the file group (chgrp or something). The problem is that i have more than 16 groups in unix.
Is there a way to do it without writing and launching a UNIX script?
回答1:
It should work using PSCP. Instructions:
- Download PSCP.EXE from Putty download page
- Open command prompt and type
set PATH=<path to the pscp.exe file>
- In command prompt point to the location of the
pscp.exe
usingcd
command - Type
pscp
use the following command to copy file form remote server to the local system
pscp [options] [user@]host:source target
So to copy the file /etc/hosts
from the server example.com
as user fred to the file c:\temp\example-hosts.txt
, you would type:
pscp fred@example.com:/etc/hosts c:\temp\example-hosts.txt
Source
回答2:
The above answer by @Ravi Dhoriya is good but sometimes it does not work. You might need to add the -scp flag to force the scp protocol:
pscp -scp fred@example.com:/etc/hosts c:\temp\example-hosts.txt
来源:https://stackoverflow.com/questions/23308092/copy-file-from-unix-to-windows-using-putty