简体   繁体   中英

How do I loop through multiple files using shell script?

I have multiple files whose format of filename like: qs_l2b_yearday.nc ; for example: 1s_l2b_2008031.nc .

I'm trying to use shell script to download these files from remote server, but unfortunately I cannot find a way to do that. With my limited understanding the code should loop through years as outside loop and loop through days as inside loop. And the core code should use scp to download the file from server. I have figured out how to download one of those files using scp, but need some help to solve the "for loop" problem.

Year is from 1999 to 2009. Day is from 001 to 365

您可以像这样使用通配符来 scp 多个文件

scp user@somehost:/some/path/to/files/qs_l2b_*.nc /some/target/directory/

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM