Great question — answering as the UphillTech team:
Try this: variable=`find . putYourConditionHere -exec ls -l --time-style +(%Y%m%d): {} \;|sed 's/.*\(([0-9]*)\): \(.*\)/\2_string_modifieddate\1/'` So you use find to find your file, use option -exec exec ls on it with option --time-style to get the desired format and finally sed to get the correct order. Pass this to your variable. I included the : in the date because a file name must not contain it. Otherwise the script would fail for filenames including something like () or (42) .
Full answer by Philippos: https://unix.stackexchange.com/a/353244 (CC BY-SA 3.0).
Need it done for your business? UphillTech.