After Using PhotoRec - CGSecurity
Keywords: After Using PhotoRec,Nach dem Gebrauch von PhotoRec,PhotoRec,Après l'utilisation de PhotoRec,Después de usar PhotoRec,Joey,Vees

# After Using PhotoRec

### From CGSecurity

english version deutsche Version versión español version française

It may be hard to sort the file recovered by PhotoRec. You can find here some ideas to help you in this process.

- JPEG file sorting using Exif meta-data.
- Under Linux, md5sum can used to find duplicate file, maybe just md5'ing only the first x bytes
  - On Windows you can use the fc utility to find duplicates, the following batch file (does not work on Win9x/ME) might help: --Joey 08:36, 17 July 2008 (CEST)

    @echo off
    setlocal ENABLEEXTENSIONS
    for %%i in (*.*) do call :test "%%i"
    endlocal
    goto :EOF
    :test
    for %%j in (*.*) do (
      if "%~1" EQU "%%j" goto :EOF
      if %~z1 EQU %%~zj (
        fc /b "%~1" "%%j">nul && echo %~1 is a duplicate of %%j
      )
    )
    goto :EOF

- Under Linux (or with perl and 'sum'), you can find duplicates in a hierarchy using find_dup or finddup from fslint.
  - On Windows you may add a "/r" (without the quotes) after the both "for"s in the above batch file
- Under Linux, for file extensions that ImageMagick can handle, you can run something like

    for file in recup_dir*/*; do convert $file $file; done

- Under Linux (or with perl and 'convert'), you can automate the above 'for' loop and do many other batch image processing with fix_img

- To read broken MS Office document (doc/xls/ppt/...) that MS Office failed to read, you can try OpenOffice. OpenOffice.org is a multiplatform and multilingual office suite and an open-source project. Compatible with all other major office suites, the product is free to download, use, and distribute.
- Some MS Office document (xls/ppt/...) may be recovered with a Word .doc extension, you may need to rename these files.
- To recover broken Outlook PST file, try Microsoft Scanpst
- Canon PowerShot models store their image sequence numbers in the Exif data, so using a program that can dump Exif data to text like jhead, and the following Perl script, you can essentially restore all the JPG files to their original names. --Vees 01:59, 8 January 2007 (CET)

    $working_dir = '.';
    $jhead_bin = '/usr/local/bin/jhead';

    @recovered_files = `ls $working_dir`;
    foreach $file (@recovered_files) {
            chomp $file;
            @exif = `$jhead_bin -v $working_dir/$file`;
            foreach $line (@exif) {
                    if ($line =~ /Canon maker tag 0008 Value = 100(\d{1,8})$/) {
                            system("mv $working_dir/$file $working_dir/IMG_$1.JPG");
                            print "IMG_$1.JPG from $file\n";
                            last;
                    }
            }
    }

- The following is a batch file for Windows that recreates the original directory layout and file names present on the card (for Canon cameras, tested with numerous photos from an EOS 20D), using the file number EXIF info (by using ExifTool, much like the above shell script. --Joey 08:36, 17 July 2008 (CEST)

    @echo off
    for %%f in (*.jpg) do call :process %%f
    goto :eof
    :process
    for /f "usebackq delims=- tokens=1,2" %%a in (`exiftool -p ^"^$FileNumber^" %1`) do set gnum=%%a&set fnum=%%b
    if "%gnum%"=="" goto :eof
    if "%fnum%"=="" goto :eof
    if not exist %gnum%CANON (
    	echo Creating directory %gnum%CANON
    	mkdir %gnum%CANON
    )
    echo Moving %1 to %gnum%CANON\_mg_%fnum%.jpg
    ren %1 _mg_%fnum%.jpg>NUL
    move _mg_%fnum%.jpg %gnum%CANON>NUL
    goto :eof

Category: Data Recovery

##### Data Recovery

- TestDisk
- PhotoRec
- download