Renaming file with its EXIF timestamp
$ exiv2 mv *.jpg
Renaming file with its Last Modified Timestamp
$ mv_pic.sh .
mv_pic.sh
# !/bin/sh
# Change file name with its Last Modified Timestamp#
# First we check for the argument
if [ -z "$1" ]; then
echo "Usage: $0 directory"
exit 1
fi
# Here we check if the argument is an absolute or relative path. It works both ways
case "${1}" in
/*) work_dir=${1};;
*) work_dir=${PWD}/${1};;
esac
# We need a for loop to treat file by file inside our target directory
for i in *; do
modif_date=`stat -c %y "${work_dir}/${i}" | cut -d '.' -f1`
mv "${work_dir}/${i}" "${work_dir}/${modif_date}.jpg"
done
$ exiv2 mv *.jpg
Renaming file with its Last Modified Timestamp
$ mv_pic.sh .
mv_pic.sh
# !/bin/sh
# Change file name with its Last Modified Timestamp#
# First we check for the argument
if [ -z "$1" ]; then
echo "Usage: $0 directory"
exit 1
fi
# Here we check if the argument is an absolute or relative path. It works both ways
case "${1}" in
/*) work_dir=${1};;
*) work_dir=${PWD}/${1};;
esac
# We need a for loop to treat file by file inside our target directory
for i in *; do
modif_date=`stat -c %y "${work_dir}/${i}" | cut -d '.' -f1`
mv "${work_dir}/${i}" "${work_dir}/${modif_date}.jpg"
done