I currently have the following bash script:
for a in `seq 16 75`;
do scp doneill@server:/mnt/device/folder/numbered_file$a.txt ./;
done;
while this does work, it is very slow. Each file, the request to the sever takes about 4-7 seconds, then sending the file takes another 3 or so seconds.
Is there a way to do this that involves only 1 command sent to the server (to minimize the time my VPN spends sending receiving each individual command)? Normally, I would do something like scp doneill@server:/mnt/device/folder/numbered_file*
but there are many thousands of files in the folder that I don't want to copy. I need to get only those few (defined by the sequence).
在bash中:
scp doneill@server:/mnt/device/folder/numbered_file{16..75}.txt ./
rsync should do the trick: http://www.manpagez.com/man/1/rsync/
You may have to fiddle a bit with the parameters, but done right, it's probably the fastest way of transferring files over ssh.
这适用于bash吗?
scp doneill@server:/mnt/device/folder/numbered_file{16..75}.txt ./
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.