It is a good practice to rename your pictures and include the date/time the picture was taken in the name.
You can use jhead to get the date/time info from the EXIF header and rename the pictures.
The following command will rename all the JPG files in the current folder(not recursively) using the EXIF info. After the operation the filenames will look like this YYYY_MM_DD_ORIGINALFILENAME.jpg
jhead -exonly -n%Y_%m_%d_%f *.jpg
You can visit the homepage for more info on jhead
Wednesday, October 20, 2010
Batch rename your pictures to include shot date
Thursday, June 24, 2010
Batch rename files using their modification date
Unlike JPG images, video files do not include some kind of EXIF table.
An easy way to remember the date your video was shot, is to include the shot date in the filename.
In my case I had tons of small video files and the only clue about the shot date was their modification date. What I needed, was a small script to rename all the video files and include each file's modification date in the new filename.
This was a bit tricky because I had to handle spaces in directory names. The key was to temporarily modify the internal field separator (IFS) to exclude space. Here is the script.
An easy way to remember the date your video was shot, is to include the shot date in the filename.
In my case I had tons of small video files and the only clue about the shot date was their modification date. What I needed, was a small script to rename all the video files and include each file's modification date in the new filename.
This was a bit tricky because I had to handle spaces in directory names. The key was to temporarily modify the internal field separator (IFS) to exclude space. Here is the script.
#!/bin/bash
OLDIFS=$IFS
IFS=$'\n'
for file in `find . -name '*.mp4'`
do
dir=`dirname "$file"`
filen=`basename "$file"`
moddate=`stat -c %y "$file"`
fdate=`date -d "$moddate" "+%Y-%m-%d"`
echo Renaming file: $filen ..
mv $file $dir/$fdate-$filen
done
IFS=$OLSIFS
Subscribe to:
Posts (Atom)