Skip to content

Instantly share code, notes, and snippets.

@amedranogil
Created July 15, 2019 22:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amedranogil/f2ea130ff9b34884128b31616de19330 to your computer and use it in GitHub Desktop.
Save amedranogil/f2ea130ff9b34884128b31616de19330 to your computer and use it in GitHub Desktop.
#!/bin/bash
#install everything needed
sudo apt install testdisk fdupes id3ren id3convert libid3-tools exiftool convmv
sudo dd if=/dev/disk of=/somefile.dd bs=512 conv=noerror,sync
#use Photorec to recover files from the disk
sudo photorec /dev/disk #or /somefile.dd
#On destination folder...
#delete duplicate files (only exact duplicates are removed)
fdupes -R -dN ./
#Rename images for better organization later on.
exiftool '-FileName<DateTimeOriginal' -d "%Y-%m-%d %H.%M.%S%%-c.%%e" */
#Convert id3 tags of MP3s
id3convert -1 */*.mp3
#rename MP3 based on id3 tags
id3ren -template='%a - %t - [%n]%s.mp3' -notagprompt */*.mp3
#fix filename coding
convmv -f CP1252 -t Utf8 -r --notest ./
#further organization can be achieved by moving files by filetype
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment