0

I have to loop through all files in folder with particular date (say- 20150902) in the filenames.

I want to do this in shell script and take the date from the argument of the script.

I was using

for f in /data/test/loader/test01/XXX/$1*; do commands done

But it doesnt loop over all the filenames.

my filenames in folder look like this:

QQQ.XX8_XX2.FW00.20150902.0005399.30345.dat

and the date which is the input to the script is

canonical
  • 13
  • 3
  • 1
    Possible duplicate of [Iterate through list of filenames in order they were created in bash](http://stackoverflow.com/questions/25577074/iterate-through-list-of-filenames-in-order-they-were-created-in-bash) – ryekayo Oct 06 '15 at 14:28
  • @ryekayo - No i think i have date field in the middle of the filename – canonical Oct 06 '15 at 14:34

1 Answers1

0

The date is in the middle of your file name, so try /data/test/loader/test01/XXX/*$1* (note the asterisk added in front of $1).

twm
  • 1,448
  • 11
  • 19