I was thinking something like
for i in `find . -name "*.log.Z"`; do mv $i name.log.Z
or something like that?
I was thinking something like
for i in `find . -name "*.log.Z"`; do mv $i name.log.Z
or something like that?
for i in `find . -name "*.log.Z"`;
do
mv $i $i`date +_%m_%d_%y_%H_%M`
done
this renames foo.log.Z -> foo.log.Z_06_16_2014_13_22,
the current time/date
What about the date and time that's on the time stamp? How do you do that?
If you have gnu date (supports the --reference=
option) you could do:
find . -name "*.log.Z" | while read fname
do
mv "$fname" "$fname"$(date --reference="$fname" +_%m_%d_%y_%H_%M)
done