我有以下改编自的脚本https://stackoverflow.com/questions/1346509/automate-scp-file-transfer-using-a-shell-script。该脚本非常适合复制一个目录。我有几个要复制的目录,每个目录都根据月份的日期命名。如果可能的话,有人能帮我如何循环复制每个目录吗?
#!/usr/bin/expect -f
# connect via scp
spawn scp -r "[email protected]:/data/scratch/ZMWRF/ZMD/WRF/OUTPUT/2020061100" ./
#######################
expect {
-re ".*es.*o.*" {
exp_send "yes\r"
exp_continue
}
-re ".*sword.*" {
exp_send "PASSWORD\r"
}
}
interact