Telegram exported Chats Help with bash renaming

Hi Community,

I absolutly love Telegram and all of its great features, especially with the desktop-clients.

I often use the chat export function. In case of some chats, I do it regularly, because of the 1500MB limitation… thats ok so far.

The exported chat folders look like that:

So their naming convention ist like “ChatExport_Day_Month_Year”.

I would like to have a naming like ChatExport_2020_06_19… so vice versa…

If one of you is perhaps more skilled with bash script renaming and especially reg expressions… and could help me create a onliner-script with find… mv… ect…, I would be super happy…

Very kind regards to this amazing community

Joe

Somebody could solve it for me, and I want to share this with you. A super friendly person in den bash IRC channel got this line for me in 10 seconds, and I am super impressed. It just works perfect:

for f in ChatExport_*; do [[ “$f” =~ ChatExport_([[:digit:]]{2})([[:digit:]]{2})([[:digit:]]{4}) ]] && mv -v – “$f” “ChatExport_${BASH_REMATCH[3]}${BASH_REMATCH[2]}${BASH_REMATCH[1]}”; done