Non è necessario usare Python, puoi farlo nel comando della riga di comando: file
ad es.
$ file *
Sams.jpg: JPEG image data, JFIF standard 1.01, aspect ratio, density 72x72, segment length 16, Exif Standard: [TIFF image data, big-endian, direntries=10, manufacturer=Apple, model=iPhone 7, orientation=upper-left, xresolution=150, yresolution=158, resolutionunit=2, software=Photos 1.5, datetime=2016:11:13 14:09:31, GPS-Data], baseline, precision 8, 4032x3024, frames 3
Quindi, puoi scaricare quei dati e ordinarli per i percorsi che desideri.
ad es.
alex@smiley:~|⇒ find . -type f -exec file {} \;
./.bash_history: ASCII text
./.bash_login: ASCII text
./.bash_profile: ASCII text
./.bashrc: ASCII text
./.bashrc.bak: ASCII text
./.cache/fontconfig/0f0db7876307790c19e1f91eb9095080-le64.cache-4: data
./.cache/fontconfig/1487dd4aecf3164c4a11193169052443-le64.cache-4: data
./.cache/fontconfig/2d5afd1bf94294700ac1600496f0236c-le64.cache-4: data
./.cache/fontconfig/3f80be19c668e16fc38439c9c84a1bc7-le64.cache-4: data
./.cache/fontconfig/49aa604a5ac92994756d3008e408245c-le64.cache-4: data
./.cache/fontconfig/558352270fb122ca08359d23b5a778d4-le64.cache-4: data
ecc.
Filtra l'output per le immagini, usando grep:
Dalla directory che memorizza i backup:
trova. -type f -exec file {} \; | immagine grep
alex@smiley:~|⇒ find . -type f -exec file {} \; | grep image
./.gradle/caches/minecraft/assets/objects/92/92750c5f93c312ba9ab413d546f32190c56d6f1f: PNG image data, 32 x 32, 8-bit/color RGBA, non-interlaced
./.gradle/caches/minecraft/assets/objects/bd/bdf48ef6b5d0d23bbb02e17d04865216179f510a: PNG image data, 16 x 16, 8-bit/color RGBA, non-interlaced