am using GNU version of tar and above command is working fine for me.
I am not sure if your version expect myfile.tar since r is present in the tar option. Please try following line (Changed r to c)
find . -type f -name "CurrentCollectorMeterReadBackup*" | xargs tar cvf myfile.tar
i think it's better to make a directory, then move these files into it and archive the directory.
step1,
mkdir x
step 2,
find . -name "your-pattern" -exec mv {} x \;
step 3,
tar cf x.tar x
or you can use loop. when dealing with first file(s) you can use tar cvf to generate a tar-ball file,
the remainds you can use tar rvf to add them into archive file one by one.
the following is a demo:
find . -name "your-pattern" -type f |
(
i=0
while read x; do
if [ $i -eq 0 ]; then
echo tar cf x.tar $x
else
echo tar rf x.tar $x
fi
((i+=1))
done
)
## but this version maybe runs very slowly.
you may use xargs to improve it. that maybe looks like
find . -name "your-pattern" -type f |
xargs -n50 |
(
.... ## the same as listed above
)
# so can reduce loop times