Rename files

My script

I wrote a Python program that took less than 24s for over 27500 files: https://github.com/jbsilva/renamer

It removes spaces and changes special characters recursively.

Renameutils

sudo pacman -S renameutils

Photos

exiftool -r -P \
    -i '#recycle' \
    -i '@eaDir' \
    -i 'SYMLINKS' \
    -i 'HIDDEN' \
    -d '%Y%m%d_%H%M%S' \
    '-filename<%f-${ImageSize}%-03c.%le' \
    '-filename<${CreateDate}%-03c.%le' \
    '-filename<${DateTimeOriginal}%-03c.%le' \
    .
exiftool -r -P \
    -i '#recycle' \
    -i '@eaDir' \
    -i 'SYMLINKS' \
    -i 'HIDDEN' \
    -d '%Y/%m' \
    '-Directory<${CreateDate}' \
    '-Directory<${DateTimeOriginal}' \
    .

If the files are already in a folder:

find . \
    -mindepth 1 -maxdepth 1 \
    -type d \
    -not \( -name '#recycle' -prune \) \
    -not \( -name '@eaDir' -prune \) \
    -print0 | xargs -0 -n1 \
    exiftool -r -P -d '%Y%m%d_%H%M%S' \
        '-filename<%f-${ImageSize}%-03c.%le' \
        '-filename<${CreateDate}%-03c.%le' \
        '-filename<${DateTimeOriginal}%-03c.%le' \

The folders #recycle and @eaDir are common in Synology NAS and should be ignored.

Aliases

Some useful aliases:

alias recc='rename -X -c --rews --camelcase --nows'
alias qmvv='qmv --format=dc --options=spaces,width=40,autowidth'
alias qmvo='qmv --format=destination-only'
alias qmvor='qmv -R --format=destination-only'
alias exif_move="exiftool -P -i '#recycle' -i '@eaDir' -i 'SYMLINKS' -i 'HIDDEN' -d '%Y/%m' '-Directory<${CreateDate}' '-Directory<${DateTimeOriginal}' ."
alias exif_rename="exiftool -P -i '#recycle' -i '@eaDir' -i 'SYMLINKS' -i 'HIDDEN' -d '%Y%m%d_%H%M%S' '-filename<%f-${ImageSize}%-03c.%le' '-filename<${CreateDate}%-03c.%le' '-filename<${DateTimeOriginal}%-03c.%le' ."
Julio Batista Silva
Julio Batista Silva
Data Engineer

I’m a computer engineer passionate about science, technology, photography, and languages. Currently working as a Data Engineer in Germany.

comments powered by Disqus