Collect files for specific hours

I have to fetch files from a location hour wise.
Eg files available at location /tmp/data/ are
A20140205.1300-1315......
.
.

A20140205.1400-1415......
.
.

A20140205.1700-1715......
.
.
.
.

Below is the code I have prepared.
But it works only for one hour.
For instance A20140205.14*,copies files with only 14 hour..

touch WX7_GP_20140205.tar
find /tmp/data -type f -name "A20140205.14*" | xargs tar rvf $HOME/sts/WX7_GP_20140205.tar

My requirement is to copy files from 13 hour to 18 hour or all files with names from A20140205.13 to A20140205.18...
How do i achieve this??

Try this wildcard A20140205.1[3-8]*

edit: You can avoid the need for touch and xargs buy getting tar to read filenames from stdin

find /tmp/data -type f -name "A20140205.1[3-8]*"  | tar -c -v -t - -f $HOME/sts/WX7_GP_20140205.tar
1 Like