I have a collection of directories, for example as below
I want to create a loop that goes in the first directory and picks up the *hhz*.sac.pzs
filename in a variable, and the other files matching *hhz*.sac in another variable (however I do not want to pick the *hhz*.sac.pzs). This is because I want to pass the file names to another program called sac.
Then I do my file processing in sac, then move to the next disectory and do the same things so I get the file name in the new directory.
.
epoz
2018.30.0.16.EPOZ.LHZ.SAC
iv.epoz..hhe_2013.074.14.40.46.0000_2599.365.23.59.59.99999.sac.pzs
iv.epoz..hhe.d.2018.028.000000.sac
iv.epoz..hhe.d.2018.029.000000.sac
iv.epoz..hhe.d.2018.030.000000.sac
iv.epoz..hhe.d.2018.031.000000.sac
iv.epoz..hhn_2013.074.14.40.46.0000_2599.365.23.59.59.99999.sac.pzs
iv.epoz..hhn.d.2018.028.000000.sac
iv.epoz..hhn.d.2018.029.000000.sac
iv.epoz..hhn.d.2018.030.000000.sac
iv.epoz..hhn.d.2018.031.000000.sac
iv.epoz..hhz_2013.074.14.40.46.0000_2599.365.23.59.59.99999.sac.pzs
iv.epoz..hhz.d.2018.028.000000.sac
iv.epoz..hhz.d.2018.029.000000.sac
iv.epoz..hhz.d.2018.030.000000.sac
iv.epoz..hhz.d.2018.031.000000.sac
test2.m
test2.m~
test.m
test.m~
haga
iv.haga..hhe_2006.111.00.00.00.0000_2599.365.23.59.59.99999.sac.pzs
iv.haga..hhe.d.2018.028.000000.sac
iv.haga..hhe.d.2018.029.000000.sac
iv.haga..hhe.d.2018.030.000000.sac
iv.haga..hhe.d.2018.031.000000.sac
iv.haga..hhn_2006.111.00.00.00.0000_2599.365.23.59.59.99999.sac.pzs
iv.haga..hhn.d.2018.028.000000.sac
iv.haga..hhn.d.2018.029.000000.sac
iv.haga..hhn.d.2018.030.000000.sac
iv.haga..hhn.d.2018.031.000000.sac
iv.haga..hhz_2006.111.00.00.00.0000_2599.365.23.59.59.99999.sac.pzs
iv.haga..hhz.d.2018.028.000000.sac
iv.haga..hhz.d.2018.028.000000.sac.vel
iv.haga..hhz.d.2018.029.000000.sac
iv.haga..hhz.d.2018.029.000000.sac.vel
iv.haga..hhz.d.2018.030.000000.sac
iv.haga..hhz.d.2018.030.000000.sac.vel
iv.haga..hhz.d.2018.031.000000.sac
iv.haga..hhz.d.2018.031.000000.sac.vel
hpac
iv.hpac..hhe_2012.326.14.06.31.0000_2599.365.23.59.59.99999.sac.pzs
iv.hpac..hhe.d.2018.028.000000.sac
iv.hpac..hhe.d.2018.029.000000.sac
iv.hpac..hhe.d.2018.030.000000.sac
iv.hpac..hhe.d.2018.031.000000.sac
iv.hpac..hhn_2012.326.14.06.31.0000_2599.365.23.59.59.99999.sac.pzs
iv.hpac..hhn.d.2018.028.000000.sac
iv.hpac..hhn.d.2018.029.000000.sac
iv.hpac..hhn.d.2018.030.000000.sac
iv.hpac..hhn.d.2018.031.000000.sac
iv.hpac..hhz_2012.326.14.06.31.0000_2599.365.23.59.59.99999.sac.pzs
iv.hpac..hhz.d.2018.028.000000.sac
iv.hpac..hhz.d.2018.029.000000.sac
iv.hpac..hhz.d.2018.030.000000.sac
iv.hpac..hhz.d.2018.031.000000.sac
hvzn
iv.hvzn..hhe_2013.024.12.00.00.0000_2599.365.23.59.59.99999.sac.pzs
iv.hvzn..hhe.d.2018.028.000000.sac
iv.hvzn..hhe.d.2018.029.000000.sac
iv.hvzn..hhe.d.2018.030.000000.sac
iv.hvzn..hhe.d.2018.031.000000.sac
iv.hvzn..hhn_2013.024.12.00.00.0000_2599.365.23.59.59.99999.sac.pzs
iv.hvzn..hhn.d.2018.028.000000.sac
iv.hvzn..hhn.d.2018.029.000000.sac
iv.hvzn..hhn.d.2018.030.000000.sac
iv.hvzn..hhn.d.2018.031.000000.sac
iv.hvzn..hhz_2013.024.12.00.00.0000_2599.365.23.59.59.99999.sac.pzs
mfnl
iv.mfnl..hhe_2017.299.00.00.00.0000_2599.365.23.59.59.99999.sac.pzs
iv.mfnl..hhn_2017.299.00.00.00.0000_2599.365.23.59.59.99999.sac.pzs
iv.mfnl..hhn.d.2018.027.235959.sac
iv.mfnl..hhn.d.2018.028.002538.sac
iv.mfnl..hhn.d.2018.029.002707.sac
iv.mfnl..hhn.d.2018.030.001756.sac
iv.mfnl..hhn.d.2018.030.001928.sac
iv.mfnl..hhn.d.2018.030.002323.sac
iv.mfnl..hhn.d.2018.031.001312.sac
iv.mfnl..hhn.d.2018.031.001946.sac
iv.mfnl..hhz_2017.299.00.00.00.0000_2599.365.23.59.59.99999.sac.pzs
iv.mfnl..hhz.d.2018.027.235959.sac
iv.mfnl..hhz.d.2018.028.002538.sac
iv.mfnl..hhz.d.2018.029.002707.sac
iv.mfnl..hhz.d.2018.030.001756.sac
iv.mfnl..hhz.d.2018.030.001928.sac
iv.mfnl..hhz.d.2018.030.002323.sac
iv.mfnl..hhz.d.2018.031.001312.sac
iv.mfnl..hhz.d.2018.031.001946.sac
msfr
iv.msfr..hhe_2011.033.00.00.00.0000_2599.365.23.59.59.99999.sac.pzs
iv.msfr..hhe.d.2018.028.000000.sac
iv.msfr..hhe.d.2018.029.000000.sac
iv.msfr..hhe.d.2018.030.000000.sac
iv.msfr..hhe.d.2018.031.000000.sac
iv.msfr..hhn_2011.033.00.00.00.0000_2599.365.23.59.59.99999.sac.pzs
iv.msfr..hhn.d.2018.028.000000.sac
iv.msfr..hhn.d.2018.029.000000.sac
iv.msfr..hhn.d.2018.030.000000.sac
iv.msfr..hhn.d.2018.031.000000.sac
iv.msfr..hhz_2011.033.00.00.00.0000_2599.365.23.59.59.99999.sac.pzs
iv.msfr..hhz.d.2018.028.000000.sac
iv.msfr..hhz.d.2018.029.000000.sac
iv.msfr..hhz.d.2018.030.000000.sac
iv.msfr..hhz.d.2018.031.000000.sac
msru
iv.msru..hhe_2004.194.10.00.00.0000_2599.365.23.59.59.99999.sac.pzs
iv.msru..hhe.d.2018.028.000000.sac
iv.msru..hhe.d.2018.029.000000.sac
iv.msru..hhe.d.2018.030.000000.sac
iv.msru..hhe.d.2018.031.000000.sac
iv.msru..hhn_2004.194.10.00.00.0000_2599.365.23.59.59.99999.sac.pzs
iv.msru..hhn.d.2018.028.000000.sac
iv.msru..hhn.d.2018.029.000000.sac
iv.msru..hhn.d.2018.030.000000.sac
iv.msru..hhn.d.2018.031.000000.sac
iv.msru..hhz_2004.194.10.00.00.0000_2599.365.23.59.59.99999.sac.pzs
iv.msru..hhz.d.2018.028.000000.sac
iv.msru..hhz.d.2018.028.000000.sac.vel
iv.msru..hhz.d.2018.029.000000.sac
iv.msru..hhz.d.2018.029.000000.sac.vel
iv.msru..hhz.d.2018.030.000000.sac
iv.msru..hhz.d.2018.030.000000.sac.vel
iv.msru..hhz.d.2018.031.000000.sac
iv.msru..hhz.d.2018.031.000000.sac.vel
nov
iv.nov..hhe_2009.345.15.00.00.0000_2599.365.23.59.59.99999.sac.pzs
iv.nov..hhe.d.2018.028.000000.sac
iv.nov..hhe.d.2018.029.000000.sac
iv.nov..hhe.d.2018.030.000000.sac
iv.nov..hhe.d.2018.031.000000.sac
iv.nov..hhn_2009.345.15.00.00.0000_2599.365.23.59.59.99999.sac.pzs
iv.nov..hhn.d.2018.028.000000.sac
iv.nov..hhn.d.2018.029.000000.sac
iv.nov..hhn.d.2018.030.000000.sac
iv.nov..hhn.d.2018.031.000000.sac
iv.nov..hhz_2009.345.15.00.00.0000_2599.365.23.59.59.99999.sac.pzs
iv.nov..hhz.d.2018.028.000000.sac
iv.nov..hhz.d.2018.028.000000.sac.txt
iv.nov..hhz.d.2018.029.000000.sac
iv.nov..hhz.d.2018.030.000000.sac
iv.nov..hhz.d.2018.031.000000.sac
solun
iv.solun..hhe_2017.080.18.00.00.0000_2599.365.23.59.59.99999.sac.pzs
iv.solun..hhn_2017.080.18.00.00.0000_2599.365.23.59.59.99999.sac.pzs
iv.solun..hhz_2017.080.18.00.00.0000_2599.365.23.59.59.99999.sac.pzs
iv.solun..hhz.d.2018.027.235957.sac
---------- Post updated at 01:51 PM ---------- Previous update was at 01:31 PM ----------
Currently I can pick the files using
pzfl=`find ./haga/ -name '*hhz*.sac.pzs' -type f`
sacfl=`find ./haga/ -name '*hhz*.sac' -type f`