My set of files are named according to GMT time zone. I successfully renamed and converted all files into the required time zone using the following steps.
1. This code removes all file extensions that are .gif rename "s/.gif//g" *
2. This code converts and renames all files for f in *; do mv -v -- "$f" "$(date -d "$f" '+%Y%m%d%H%M')"; done
- Example conversion:
‘15Z29Aug2017’ -> ‘201708292030’
Unfortunately I have to set the extension .gif once again to all files using for f in *; do mv "$f" "$f.gif"; done
How exactly can I skip the file extension removal by editing my code in step 2 ?
Step 2 taken from: How can I batch convert folder names from one date format to another