2

Yesterday, during data transmission to an external hard drive, all data was lost due to unexpected HDD crash. I've tried to use PhotoRec for a specific partition, and it retrieved over 50 000 images, nevertheless, most of the obtained files are older than 3-5 months.

In advance, thank you for your help. :)

Zanna
  • 70,465

3 Answers3

2

In case your JPG files have EXIF data stored this can easily be accomplished with

jhead Install jhead

Command line tool to manipulate EXIF data, and to touch the timestamp or rename a jpg file according to the EXIF data stored within the file.

jhead -ft unnamed.jpg  # to touch the time
jhead -n%Y%m%d-%H%M%S unnamed.jpg # to rename in this format YYYYMMDD-hhmmss

exiv2 Install exiv2

Another, similar tool will also manipulate and use EXIf data from other file fomats including:

Supported formats are JPEG, TIFF, PNG, JP2, Adobe DNG, Canon CRW, Canon THM, Nikon NEF, Pentax PEF and XMP sidecar files. Read-only support is currently available for PSD and several TIFF-based RAW formats: Canon CR2, Fujifilm RAF, Minolta MRW, Olympus ORF, Sony ARW and Sony SR2. Manpage exiv2

exiv2 rename unnamed.jpg # will rename to YYYYMMDD_hhmmss.jpg

Shotwell

Shotwell Photo Manager is installed by default and can sort images according to their EXIF data:

enter image description here

Takkat
  • 142,284
0

I use sort-pictures from recoverjpeg tool, it sorts pictures nicely into date directories.

Running sort-pictures will scan the current directory for files named after the template image?????*.jpg (image followed by at least five characters followed by .jpg). A new hardlink will be created for each file in one of the following directories:

  • invalid The picture is an invalid JFIF file.
  • small The picture size is less than 100,000 bytes.
  • undated Sort-pictures was unable to determine the date of the picture from the exif tags.
  • YYYY-MM-DD A directory representing the date at which the picture was taken.

Install from universe:

# enable universe repo if not already
sudo add-apt-repository universe
sudo apt update
# install
sudo apt install recoverjpeg

Something like this should do the job:

n=0
# loop jpg-files from recup-dir (the ones starting with `f` are "full" size
for f in recup*/f*.jpg; do
    # mv the file to a subdir of the current working dir "./sorted"
    # renaming to image??????.jpg
    mv "$f" sorted/image$(printf "%06d\n" $n).jpg
    # print and increment counter
    printf '\r%d' $n;
    n=$((n+1))
done
echo
# go into "sorted" directory and run `sort-pictures`
cd sorted && sort-pictures

Then, you have nicely sorted images :-)

pLumo
  • 26,947
  • This will move the files one by one which will work fine, but I'm sure there is a nicer solution renaming many files in one go, but no time to test something now... – pLumo Jul 20 '20 at 06:45
0

You can recover all images with the method you want. After this, you can sort them by date with your favorite data explorer (for example nautilus).

slashcrack
  • 1,083