How about this:
for i in *.report-server; do echo mv "$i" "$(date -d@${i%%.*} +%d-%m-%Y.${i##*.})"; done
This loops over the .report-server
files in the current directory and for every file prints a line like
mv 1509106656.32538_1.report-server 27-10-2017.report-server
where you can check the file name. If it does what you want, simply remove echo
from the command and run it to perform the renaming.
Be careful! If you end up having multiple files with the same date mv
will (by default) silently overwrite the first ones. If you want to preserve the (presumably unique) .32538_1
part, change ${i##*.}
to ${i#*.}
in the command. If you want mv
to ask before overwriting files, add the -i
option.
dd-mm-yyyy
? See mandatory xkcd comic about ISO 8601 :-) – egmont Jan 10 '18 at 15:18