![]() |
VOOZH | about |
Puede ser difícil ordenar los archivos recuperados por PhotoRec. Aquí encontrará algunas ideas para ayudarlo en este proceso.
Ejemplo: $ python recovery.py /home/me/recovered_files /home/me/sorted_files
#!/usr/bin/env python
import os
import os.path
import shutil
import sys
source = sys.argv[1]
destination = sys.argv[2]
while not os.path.exists(source):
source = raw_input('Enter a valid source directory\n')
while not os.path.exists(destination):
destination = raw_input('Enter a valid destination directory\n')
for root, dirs, files in os.walk(source, topdown=False):
for file in files:
extension = os.path.splitext(file)[1][1:].upper()
destinationPath = os.path.join(destination,extension)
if not os.path.exists(destinationPath):
os.mkdir(destinationPath)
if os.path.exists(os.path.join(destinationPath,file)):
print 'WARNING: this file was not copied :' + os.path.join(root,file)
else:
shutil.copy2(os.path.join(root,file), destinationPath)
$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;
}
}
}
--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
for file in recup_dir*/*; do convert $file $file; done
En este ejemplo, chequeamos los primeros 80k de recup_dir*/*.sib
for file in recup_dir.*/*.sib; do MD5=`dd count=20 bs=4k if="$file" 2> /dev/null|md5sum`; echo "$MD5 $file"; done|sort 1a07198de3486ff2ecab7859612fe7ba - Box Clever.sib 33105f4a7997b2e2681e404b3ac895f2 - Random, Matching - 2 bars.sib 376e0c53e78e56ba6f2858d9680f8c6b - 01aIdentifyCommonInst.sib b0b40a516a1e26660748a0a09cdf3207 - 01ArticulationFlashcards.sib
Cada checksum es únivoco, no hay posibilidad de duplicados (es decir, la posibilidad es ínfima)
--Joey 08:36, 17 July 2008 (CEST)
@echo off SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION SET FILELIST= FOR %%i IN (*) DO ( FOR %%j IN (!FILELIST!) DO ( IF %%~zi EQU %%~zj ( fc /b "%%~i" "%%~j">NUL && echo "%%~i" = "%%~j" ) ) SET FILELIST=!FILELIST! "%%~i" ) ENDLOCAL
#!/bin/sh OUTF='rm-dups.sh' if [ -e $OUTF ]; then echo "File $OUTF already exists." exit 1; fi echo "#!/bin/sh" > $OUTF fdupes -r -f . |sed -r 's/(.+)/rm \1/' >> $OUTF chmod +x $OUTF
La mayoría de los mp3 y archivos ogg tienen información embebida sobre el Título, Album y Autor. Puede usar EasyTag para automáticamente renombrar los MP3 recuperados usando esta información.