scp
准备待复制的目录
1.
$ find /home/tsing87/onpolicy/onpolicy/scripts/results/Human/simple_human/rmappo -type d -name "ortho*" | xargs -I 'dir' echo dir
这样就可以将所有符合条件的目录打印出来,直接拷贝到本机txt
文件,比如prepare.txt
文件中
如果想要直接把输出写入到文件当中👇
$ find /home/tsing87/onpolicy/onpolicy/scripts/results/Human/simple_human/rmappo -type d -name "fixed_GCR_predator3_prey1_RR0_NG0.5_DisAlpha*_view0.5_NL*" | xargs -I 'dir' echo dir > /home/tsing87/prepare.txt
2.
拷贝(scp)到本机
$ cat prepare.txt | xargs -I 'dir' scp -r tsing87@10.20.101.28:dir /Users/huangruixin/Desktop/Master/Projects/onpolicy_appendix/onpolicy_render/predator1_prey1_RR0_NG0.5_DisAlpha_view0.5_NL
使用rsync代替scp
$ cat prepare.txt | xargs -I 'dir' rsync -av --exclude={'*.log','latest-run','logs','code','*.patch','tmp','*.json','*.txt','*.yaml','*.wandb','critic.pt'} tsing87@10.20.101.39:dir /Users/huangruixin/Desktop/Master/Projects/onpolicy_appendix/onpolicy_render/ortho
好处:可以排除掉.log
这种又大又用不上的文件,--exclude
可以多次使用👆也可以直接使用--include
mv(还是没解决,如何才能每个文件在其对应的目录里上移n级)
$ find /Users/huangruixin/Desktop/Master/Projects/onpolicy_appendix/onpolicy_render/predator1_prey1_RR0_NG0.5_DisAlpha_view0.5_NL -type f -name "actor.pt"| xargs -I 'file' mv file ../../..
例子:ssh到我的台式机
prepare:在台式机开启openssh服务
openssh服务如何开启、关闭、查看其状态,点这
-
安装openssh-server
sudo apt-get install openssh-server
-
打开openssh服务
service sshd start
范式
rsync -av username@ip:source destination
获取username
whoami
获取ip
ifconfig -a
实例
rsync -av --exclude={'*.log','latest-run','logs','code','*.patch','tmp','*.json','*.txt','*.yaml','*.wandb','critic.pt'} huangruixin@172.16.0.233:/home/huangruixin/clash /Users/huangruixin/Desktop