I see I can achieve this using stat command as below and then trying to match with date parameter that can be passed to the script,
file_pattern="file.subfile.P*.lastfile"
files=$(ls $file_pattern 2>/dev/null)
for file in $files; do last_modified_date=$(stat --format='%y' "$file" | cut -d' ' -f1)
if [ "$last_modified_date" == "$input_date" ]; then
echo "Processing file: $file (Last Modified: $last_modified_date)"
else
echo "Skipping file: $file (Last Modified: $last_modified_date)"
fi
done
Is this better or trying to add suffix date in source file & then trying to capture is better?