blog.minskio.co.uk

Content and theme behind minskio.co.uk
Log | Files | Refs

notes-on-sorting-photos.md (2167B)


      1 ---
      2 title: "Notes on sorting Photos"
      3 date: 2019-12-23T11:50:00
      4 lastmod: 2023-02-19T21:05:00
      5 tags: ["Android", "Formats", "Guides", "Linux", "Media", "Minimalism", "Notes", "Snippets", "Software"]
      6 ---
      7 
      8 My smart phone is an android device, it connects to my computer via MTP over USB and I store my photographs on cloud storage. Subsequently I want these pictures to be sorted, and I don't want any duplicates.
      9 
     10 This entire process is structured around using ArchLinux. Below is how I complete this:
     11 
     12 # Mount your phone's storage
     13 I use `simple-mtpfs` to access my phone, this is installed from the AUR using `yay`:
     14 ```
     15 yay -S simple-mtpfs
     16 simple-mtpfs -l
     17 mkdir phone
     18 simple-mtpfs --device 1 phone
     19 ls phone
     20 ```
     21 This should now print out the file and folder structure of your phone.
     22 
     23 # Install Phockup
     24 Now we're going to install `phockup` to sort the files into a coherent folder structure:
     25 ```
     26 sudo pacman -S perl-image-exiftool python3
     27 curl -L https://github.com/ivandokov/phockup/archive/latest.tar.gz -o phockup.tar.gz
     28 tar -zxf phockup.tar.gz
     29 sudo mv phockup-* /opt/phockup
     30 sudo ln -s /opt/phockup/phockup.py /usr/local/bin/phockup
     31 ```
     32 
     33 # Mount your storage
     34 Now we're going to mount our cloud storage destination, using the ever useful `rclone`:
     35 ```
     36 mkdir pictures
     37 rclone mount drive-pictures: pictures --daemon
     38 ```
     39 
     40 # Sort your images
     41 Now we can invoke `phockup` to sort and move the source files to the destination folder:
     42 ```
     43 phockup phone/DCIM/Camera/ pictures/personal/photos/ -m
     44 mv phone/Pictures/Screenshots/* pictures/personal/screenshots/ -v
     45 rm -rf phone/DCIM/.thumbnails
     46 find phone -maxdepth 2 -type d -not -path "*/\.*" -empty -delete -print
     47 ```
     48 I also move my screenshots, as I like these being backed up but I don't care about how they're sorted.
     49 I also delete unused thumbnails and empty folders, just to keep things tidy.
     50 
     51 # Dedupe your images
     52 Lastly, I deduplicate the images using `jdupes`. This will prompt you for every match it finds which copy you want:
     53 ```
     54 yay -S jdupes
     55 jdupes pictures/personal -rd
     56 ```
     57 
     58 And you're done.
     59 
     60 * **Edit 2020-10-26:** Improved empty directory deletion section
     61 * **Edit 2023-02-19:** Print list of directories removed